tupleof seems to break encapsulation

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Sep 4 18:23:09 UTC 2020


On Fri, Sep 04, 2020 at 07:36:00PM +0200, Jacob Carlborg via Digitalmars-d-learn wrote:
[...]
> It's useful for serialization and, as you can see in your example, for
> debugging as well. `writeln` will print the values of the fields in a
> struct, even for private fields.

It's certainly useful, but violates private.  I'd propose restricting it
to -debug or at the very least @system, so that normal @safe code will
behave as expected.


T

-- 
It's amazing how careful choice of punctuation can leave you hanging:


More information about the Digitalmars-d-learn mailing list