www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5043] New: writeln with empty arrays should write something useful

reply d-bugmail puremagic.com writes:
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: -------
Oct 11 2010
next sibling parent d-bugmail puremagic.com writes:
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: -------
Oct 11 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
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: -------
Dec 16 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
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: -------
Jan 09 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
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: -------
Sep 02 2011
prev sibling parent d-bugmail puremagic.com writes:
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: -------
Nov 29 2012