Rectangular or 2d associative arrays
Bill Baxter
dnewsgroup at billbaxter.com
Fri Mar 16 19:06:08 PDT 2007
Frits van Bommel wrote:
> Falk Henrich wrote:
>> David Freitas wrote:
>>
>>> int[char] x; // Visually: = ['a':1, 'b':2] //
>>> associative
>>> array x['b'] = 123;
>>> writefln(x); // this prints out: [b:2063597568]
>>> writefln(x['b']); // this prints out: 123
>>>
>>> This just doesn't seem intuitive to me? Why is there a "garbage" value
>>> being printed out?
>>
>> What would you expect D to print out? How can the language know how to
>> interpet arrays of some type? Hard coding some special output format for
>> all types of arrays into the language is not a wise idea.
>
> Writef(ln) and other functions that do formatting use the TypeInfo
> provided by their varargs to construct readable representations of their
> parameters. This case just seems to be buggy.
Probably related to bug 1000:
http://d.puremagic.com/issues/show_bug.cgi?id=1000
More information about the Digitalmars-d-learn
mailing list