Andrei Alexandrescu wrote:
Walter Bright wrote:
Andrei Alexandrescu wrote:
Walter Bright wrote:
Andrei Alexandrescu wrote:
There will be a global reference to a Locale class, e.g.
defaultLocale. By default the reference will be null, implying the
C locale should be in effect. Applications can assign to it as they
find fit, and also pass around multiple locale variables.
I disagree with being able to assign to the global defaultLocale.
This is going to cause endless problems. Just one is that any
function that uses locale can no longer be pure. defaultLocale
should be immutable.
Any function that is locale aware should be parameterized with a
locale parameter. (Not only is that better design, it self-documents
the dependency.)
I don't understand this. That means there's no more default locale.
Here's what I had in mind:
class Locale { ... }
// function parameterized with an optional locale
void foo(Data d, Locale loc = null);
So there's no more default locale. If you pass in null, that's the
default locale.
That's fine, I was thrown off by your reference to a "global reference".
Well I was thinking a global reference might be handy for people who
e.g. want to set the locale once and then be done with it.
That's what I was objecting to!
I think only
a few apps actually manipulate multiple locales simultaneously. Most
would just want to load the locale present on the user's computer and
then use it.
User settable global state is eeevil.