Thread overview
[Issue 5043] New: writeln with empty arrays should write something useful
Oct 11, 2010
Peter Alexander
Dec 16, 2010
Denis Derman
Sep 02, 2011
Kenji Hara
Nov 29, 2012
Andrej Mitrovic
October 11, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5043

           Summary: writeln with empty arrays should write something
                    useful
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: peter.alexander.au@gmail.com


--- Comment #0 from Peter Alexander <peter.alexander.au@gmail.com> 2010-10-11 15:29:18 PDT ---
writeln( [1, 2, 3] ); // prints "[1, 2, 3]"
writeln( [] ); // prints "" (nothing)

Why doesn't writeln( [] ) print "[]"? It seems to me that "[]" would be far more useful, and it is certainly more consistent with the non-empty array behaviour.

I know this is a minor thing, but if I'm trying to debug, blank lines aren't very much use, and actually cause more confusion than enlightenment.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 11, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5043


bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs@eml.cc


--- Comment #1 from bearophile_hugs@eml.cc 2010-10-11 16:19:36 PDT ---
The same bug is present with associative arrays:


import std.stdio: writeln;
void main() {
    int[int] aa;
    writeln(aa);
}


In this case I expect an output like:
[]
or even:
[:]


See also bug 3813

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 16, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5043


Denis Derman <denis.spir@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |denis.spir@gmail.com


--- Comment #2 from Denis Derman <denis.spir@gmail.com> 2010-12-16 00:24:11 PST ---
(In reply to comment #0)
> writeln( [1, 2, 3] ); // prints "[1, 2, 3]"
> writeln( [] ); // prints "" (nothing)
> 
> Why doesn't writeln( [] ) print "[]"? It seems to me that "[]" would be far more useful, and it is certainly more consistent with the non-empty array behaviour.
> 
> I know this is a minor thing, but if I'm trying to debug, blank lines aren't very much use, and actually cause more confusion than enlightenment.

+++

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 09, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5043


Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei@metalanguage.com
         AssignedTo|nobody@puremagic.com        |andrei@metalanguage.com


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 02, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5043


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2011-09-02 12:09:10 PDT ---
https://github.com/D-Programming-Language/phobos/pull/126

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 29, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5043


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
                 CC|                            |andrej.mitrovich@gmail.com
         Resolution|                            |FIXED


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