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 <nalagin...@gmail.com> 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