std.locale
Walter Bright
newshound1 at digitalmars.com
Sun Mar 1 20:11:40 PST 2009
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".
More information about the Digitalmars-d
mailing list