Thread overview
[Issue 10041] New: ufcs writeln of associative array
May 08, 2013
Kenji Hara
May 08, 2013
Kenji Hara
May 07, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10041

           Summary: ufcs writeln of associative array
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: bearophile_hugs@eml.cc


--- Comment #0 from bearophile_hugs@eml.cc 2013-05-07 15:02:36 PDT ---
I don't know if this a Phobos or DMD bug.


import std.stdio: writeln;
void main () {
    auto aa = [1: 2];
    aa.writeln;
    writeln(aa);
}


Output with dmd 2.063beta:

AssociativeArray!(int, int)(18C2FE0)
[1:2]


Expected something like:

[1: 2]
[1: 2]

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 08, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10041


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, wrong-code
           Platform|x86                         |All
         OS/Version|Windows                     |All
           Severity|normal                      |regression


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2013-05-07 17:40:47 PDT ---
(In reply to comment #0)
> I don't know if this a Phobos or DMD bug.

This is a regression in 2.063a.

https://github.com/D-Programming-Language/dmd/pull/1975

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 08, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10041



--- Comment #2 from bearophile_hugs@eml.cc 2013-05-07 18:05:43 PDT ---
(In reply to comment #1)
> (In reply to comment #0)
> > I don't know if this a Phobos or DMD bug.
> 
> This is a regression in 2.063a.
> 
> https://github.com/D-Programming-Language/dmd/pull/1975

Thank you Kenji.

- - - - - - -

A mostly unrelated question. Python dict formatting uses a space after the colon, probably to increase readability:

>>> {1:2, 2:3}
{1: 2, 2: 3}

I kind of like that extra space. Is it a good idea to add it to D AA formatting?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 08, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10041



--- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2013-05-07 18:22:04 PDT ---
(In reply to comment #2)
> A mostly unrelated question. Python dict formatting uses a space after the colon, probably to increase readability:
> 
> >>> {1:2, 2:3}
> {1: 2, 2: 3}
> 
> I kind of like that extra space. Is it a good idea to add it to D AA formatting?

I have no argument about the space after colon...

void main() {
    import std.stdio;

    // Fixed a while ago
    pragma(msg, [1, 2]);    // [1, 2]
    writeln([1, 2]);        // [1, 2]

    // Currently different output between compiler and std-lib
    pragma(msg, [1:1, 2:2]);    // [1:1,2:2]
    writeln([1:1, 2:2]);        // [1:1, 2:2]
}

Both compiler and Phobos prints no space after colon. Currently it is consistent.

But, I can argue that compiler should insert a space after comma in AA literal printing.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 08, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10041



--- Comment #4 from github-bugzilla@puremagic.com 2013-05-08 03:51:49 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/259af5ff9e7f4231f5ce8df00b8f1d81e90042fe fix Issue 10041 - ufcs writeln of associative array

https://github.com/D-Programming-Language/dmd/commit/e6ccdf5d43c75d87dc0a777760830b2b2e7fe3ee Merge pull request #1975 from 9rnsr/fix10041

[REG2.063a] Issue 10041 - ufcs writeln of associative array

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 08, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10041


bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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