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

forkit forkit at gmail.com
Sat Jun 4 05:07:10 UTC 2022


On Saturday, 4 June 2022 at 01:41:52 UTC, Mike Parker wrote:
>
> ....
> It would require adding a new protection keyword to the 
> language. The general policy for that is that there must be a 
> strong benefit. Given that we already have a way to achieve the 
> same goal (putting classes in their own modules), then the 
> benefit of such a keyword is extremely weak.

Well, I've never encounted as much resistance to change, as what 
occurs when someone brings this topic up in a discussion.

I really do think there is idealogical resistance to such a 
change, and it's this that brings about these strong reactions.

Cause D has plenty of completely useless attributes. I don't 
think another one is going to make much difference.

In the meantime, if a D programmer wants static, compile time 
verification that that the encapsulation of a class is not 
broken, then they MUST put that class in a separate module (one 
module per class).

No exceptions.


More information about the Digitalmars-d mailing list