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

bauss jj_1337 at live.dk
Wed Jun 8 10:20:37 UTC 2022


On Wednesday, 8 June 2022 at 10:00:37 UTC, Ola Fosheim Grøstad 
wrote:
>
> My view is that all of the proposed syntaxes are bad and would 
> be confusing to people coming to the language.
>

But so is the current behavior to people that come to the 
language.

I see people asking every other week about why something isn't 
"private".

I think a lot of other people can testify to that too.

The solutions where at least allow one to opt-out of something, 
it's completely optional and it won't confuse anyone who don't 
use it.

In fact it might make it more understandable since you will 
realize that what you thought was private wasn't really private 
and that if you want it private to something then you specify 
"this".

It's much better than the current system where you have to move 
your classes to a new module, because then you lose __all__ 
friend capabilities.

In some cases you might want both and D does not give you that.

You have to pick either friends only or privates only.


More information about the Digitalmars-d mailing list