www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13680] New: Better printing of class instances that don't


          Issue ID: 13680
           Summary: Better printing of class instances that don't have a
           Product: D
           Version: unspecified
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: bearophile_hugs eml.cc

This program shows the current default printing of class instances (dmd

class Foo {}
void main() {
    import std.stdio;
    Foo f;
    f = new Foo;
    writeln(f, " ", cast(void*)f);


test.Foo 2001FE0

But perhaps it's better for D writeln to print class instances (that don't have
a toString) more like Java:

test.Foo null
test.Foo 2001FE0 2001FE0

This is useful in debugging and code development, because the address allows to
see what class instances are equal.

Nov 04 2014