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

forkit forkit at gmail.com
Thu Jun 9 06:21:08 UTC 2022


On Thursday, 9 June 2022 at 05:52:10 UTC, rikki cattermole wrote:
> private(scope)
>
> Nice and simple, if you know what private and scope does, you 
> can probably guess what it does here.

It's just those brackets that bother me. Something doesn't seem 
right with them there like that. Consider where else in the 
language () is used, for example.

btw.

In swift (where they seem to have actually thought this out 
sensibly):

'fileprivate' -> means an entity that is accessible anywhere in 
that file.

'private' -> means an entity that cannot be accessed anywhere 
except for the enclosing type, such as a class

so here's yet another idea: - just an idea, not a proposal ;-)

private -> no change. means an entity that is accessible anywhere 
in that file.

scopeprivate -> means an entity that cannot be accessed anywhere 
except for the enclosing type, such as a class



More information about the Digitalmars-d mailing list