std.locale

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Mar 1 19:29:57 PST 2009


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.


Andrei



More information about the Digitalmars-d mailing list