tupleof seems to break encapsulation

Paul Backus snarwin at gmail.com
Fri Sep 4 18:42:31 UTC 2020


On Friday, 4 September 2020 at 18:23:09 UTC, H. S. Teoh wrote:
> 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

Previously:

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


More information about the Digitalmars-d-learn mailing list