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

Re: 200alpha13



On Mar  7, Matthew Flatt wrote:
> I like the idea of adding `string-locale<?', etc., instead of changing
> `string<?'. The new functions would be
> [...]

IMO, this is not a good idea:

1. As you said, there is still a parameter needed.

2. Each of these functions would do a system call to set the locale,
   and I don't trust these to be cheap enough (I can easily imagine a
   super smart OS flipping libraries around whenever the locale is
   changed, or even popping up windows to ask you to download support
   etc).  In any case, I think that writing them in Scheme, adding
   only the weight of parameterize wouldn't be much more expensive.

3. If the goal is avoiding using parameterize, then I don't think it
   saves much, since the normal scenario is big chunks of code working
   in the same locale setting so when parameterize would be used to
   change it, it would be with higher-level functions.

4. And the most important thing -- doing this will force either
   writing programs that are hard-wired to using or not using locales,
   or to pass around yet another argument (or use the parameter!) to
   know what function to use.  Combined with the above, a program that
   does a lot of string processing would end up doing something silly
   like checking the parameter to choose a function to call, and the
   function itself would do the system call which can mean a
   significant overhead.

I like the idea of the parameter since it reflects the way I interact
with the OS now -- I change the environment variable, and programs
like ls do things differently.  If I wanted a version of ls that
doesn't change, I'd wrap it in a script that would unset it locally
(AFAIK, ls doesn't even have a command-line argument to avoid
locales).

I think that the argument of doing things in a more Scheme-ish way is
not too strong since I don't see any problems with parameters, but
more than that -- since locales are something relatively new, I think
it is better to stay as close to the C model since that is not likely
to change too much.

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!