[R6RS] Locales

Michael Sperber sperber
Fri Jul 1 07:10:18 EDT 2005


Marc Feeley <feeley at iro.umontreal.ca> writes:

> Why should a locale be specified with a string?  Wouldn't a
> symbol be more sensible?  I have no experience with this, so
> please correct me if I am wrong.  A symbol also avoids the
> need to create a copy of the string when current-locale is
> called.

I think both are poor choices as (the only) choice of argument for
WITH-LOCALE, given that locales really are structured entities.
Moreover, it doesn't really matter as long as we don't specify a
single locale one might use.  Worse, you can't even well whether a
given string names a locale or not.

How about giving them a little API and their own type?

(locale? obj)
  Returns #t if OBJ is a locale, #f if not.

(string->locale string)
  If strings names a locale, returns that locale, #f if not.

(locale-name locale)
  Returns the name of a locale as a freshly allocated string.

(available-locales)
  Returns a freshly allocated list of locales that are available in
  the system.  (This list is not necessarily exhaustive.)

This at least gives you some capability without standardizing on the
locale names themselves.  It also avoids the need for copying with
CURRENT-LOCALE.

-- 
Cheers =8-} Mike
Friede, V?lkerverst?ndigung und ?berhaupt blabla


More information about the R6RS mailing list