[Issue 4762] New: Textual representation of struct that doesn't define toString()
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Aug 29 15:58:07 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4762
Summary: Textual representation of struct that doesn't define
toString()
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2010-08-29 15:57:55 PDT ---
This D2 program:
import std.stdio: writeln;
struct Foo { int x; string s; }
void main() {
Foo f = Foo(1.5, "hello");
writeln(f);
}
With DMD 2.048 it prints:
Foo
When a struct doesn't define a toString() I'd like (mostly for debugging
purposes) writeln/format to create a bit better textual representation, for
example it may show fields values:
Foo(x=1.5, s="hello")
See also bug 3813
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list