guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Request] How about adding with-locale?


From: Nala Ginrut
Subject: Re: [Request] How about adding with-locale?
Date: Sat, 24 Mar 2012 12:43:42 +0800

I know it's not the best implementation, I didn't consider the multi-threads situation.
But it's food of thinking.

Regards.

On Sat, Mar 24, 2012 at 12:37 PM, Nala Ginrut <address@hidden> wrote:
Hi folks!
I encountered a bug in my project for these days. Finally I realized it's because of my locale is zh_CN.UTF-8 in default. But in many protocols, it needs
the result of strftime be in English. Anyway, I think there should be an elegant way to change locale temperately. So I think maybe with-locale would be useful.

---------------------------------------------------------------------
(define-syntax-rule (with-locale i c e0 e1 ...)
  (let ([old (setlocale i)])
    (dynamic-wind
    (lambda () (setlocale i c))
    (lambda () (begin e0 e1 ...))
    (lambda () (setlocale i old)))))
---------------------------------------------------------------------

What you guys think?

Regards.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]