[Issue 9872] format should include class field values
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jul 4 17:09:03 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=9872
--- Comment #5 from Andrej Mitrovic <andrej.mitrovich at gmail.com> ---
I think the really consistent part about formatting in Phobos is that the
output tends to be semantically-correct syntax.
S(0, 0) is correct as you can construct an instance of `S` this way. But `C(0,
0)` would be semantically incorrect as that's not how classes are constructed.
You'd (likely) need to use `new C` and you'd have to care about which
constructors are actually implemented, so `new C(0, 0)` might not even be
semantically correct either.
Perhaps instead of changing default formatting a better option would be to have
a format spec that dumps out the entire representation of the aggregate. "%s"
is taken but we could introduce something else.
We could also just close this as WONTFIX.
--
More information about the Digitalmars-d-bugs
mailing list