www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5945] New: redBlackTree printing

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

           Summary: redBlackTree printing
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



This little program:


import std.stdio, std.container;
void main() {
    auto t = redBlackTree(0, 7, 5, 2);
    writeln(t);
    writeln(t[]);
}


Prints (DMD 2.053 beta):
std.container.RedBlackTree!(int).RedBlackTree
[0, 2, 5, 7]


But often I'd like collections to print something that's able to generate the
data structure again, as in Python:

 s = set([1, 2, 3])
 s
set([1, 2, 3])
 l = [1, 2, 3]
 l
[1, 2, 3]
 d = {1:1, 2:2, 3:3}
 d
{1: 1, 2: 2, 3: 3} This is very useful for debugging, logging, for quick scripts, etc. So I'd like one of the two (the first one?) to print something more like this instead: redBlackTree(0, 2, 5, 7) This too is acceptable: std.container.redBlackTree(0, 2, 5, 7) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 07 2011