std.locale
Daniel Keep
daniel.keep.lists at gmail.com
Mon Mar 2 06:38:54 PST 2009
Andrei Alexandrescu wrote:
> Georg Wrede wrote:
>> *** How to print arrays ***
>>
>> You print arrays in a predictable and expected way.
>>
>> D array printing is for non-GUI stuff. Hence, you use the C locale,
>> period.
>
> I think the C locale (or any predefined locale) tells what left bracket
> I should use for array, what separator, and what right bracket. For now
> the left and right brackets were eliminated because the user can easily
> add them on the caller side. The separator is a space simply because it
> looks the least harmful. But for example I don't have a good solution
> for what to print as the separator between a hash key and a hash value.
> A simple, extensible locale support would have allowed me to stop
> worrying about that.
>
> Also, D array printing is not only for console - a GUI may use to!string
> with arrays.
>
> But overall I guess I'll let myself bludgeoned into complacency...
>
>
> Andrei
As far as I'm concerned, an array should be printed as close to how it
would be represented in the language as possible. If the user needs to
format the array, then they need to format the array, not the runtime.
-- Daniel
More information about the Digitalmars-d
mailing list