[Issue 3821] writeln doesn't detect recursive data structures yet

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Dec 28 10:53:26 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=3821

--- Comment #8 from berni44 <bugzilla at d-ecke.de> ---
(In reply to safety0ff.bugz from comment #6)
> This looks like a Variant toString bug rather than a writeln bug.

I don't think so, because it's not limited to Variant. Every recursive data
structure cannot be printed. See the example of Andrej. (Which IMHO isn't
invalid.)

The problem is a recursive call to formatValue in std.format, which might have
intemediate steps that are outside of std.format, but lead back there.

To fix this, it would be necessary to keep somehow a (static) record, which
items (*) where processed by formatValue and just return "*** recursion ***" or
something like this, when one is to be printed again.

(*) Only items need to be considered, that could contain a recursion.

--


More information about the Digitalmars-d-bugs mailing list