Using closure in function scope to make "real" private class members

forkit forkit at gmail.com
Thu Jun 9 01:19:54 UTC 2022


On Thursday, 9 June 2022 at 01:09:14 UTC, Adam Ruppe wrote:
> On Thursday, 9 June 2022 at 01:04:26 UTC, forkit wrote:
>> IMO, without justification.
>
> Maybe you should fork it.

when I win the lotto, that's what I'll do (cause i'd need a team 
of pretty good compiler developers to get anywhere, and they hard 
to find, and kinda expensive to employ ;-)

Their very first project would be:

private - private, as it should be.

private[module] - private as it currently is.

Then, no need to do 'workarounds' anymore.

Co-operative mutablity will no longer be the default. You'll have 
to opt-in to it.

Now, the compiler will tell you when you're invariants are being 
compromised.

You won't have to ever 'remember' to 'just not do it'.



More information about the Digitalmars-d mailing list