std.locale

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Mar 1 19:42:49 PST 2009


Georg Wrede 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.
> 
> The two programs that are most "locale aware" are usually spread sheets 
> and word processors.
> 
> It is usual that the user needs to write, say, in Swedish or in Russian, 
> while in a Finnish setting. Or that one wants to use a decimal separator 
> other than what is "proper" for the country.
> 
> For example, a lot of people use "." instead of the official "," in 
> Finland, and many use time as "18:23" instead of "18.23".
> 
> 
> For this purpose, these programs let the users define these any way they 
> want.

That's exactly what my proposal is doing. People can start with the 
defaults of the Finnish locale and then overwrite whichever parts they want.

> I think the notion of locales is, slowly but steadily, going away.

Do you have any data backing this up?

> It was a nice idea at the time, but with two problems: users don't use 
> it, and programmers don't use it.

Is it because it hasn't been properly packaged?

> Of course, eventually we will want to "do something" about this. But 
> that should be left to the day when real issues are all sorted out in D. 
> This is a non-urgent, low-priority thing.

I guess. Now please tell me how I print arrays in D.


Andrei



More information about the Digitalmars-d mailing list