[Issue 4605] Wrong print of an int[string] aa

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Aug 29 18:47:48 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4605


Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich at gmail.com


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2010-08-29 18:47:36 PDT ---
(In reply to comment #0)
> This D2 program, compiled with dmd 2.048b:
> 
> 
> import std.stdio;
> void main() {
>     int[string] aa = ["10":10, "20":20];
>     writeln(aa);
> }
> 
> 
> Prints (note the 1:10, that is a bug):
> 20:20 1:10
> 
> 
> The expected less buggy and less barbaric output is:
> ["10": 10, "20": 20]
> Or:
> ["20": 20, "10": 10]

It get's even worse:

import std.stdio;
void main() {
    int[string] aa = ["100":1, "200":1, "300":1, "400":1];
    writeln(aa);
}

Prints:

400:1 3:1 2:1 1:1

For your second code, I agree. I would prefer if D took an approach similar to
other languages and printed out something like:

[[5:6, 7:8]:2]

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list