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

forkit forkit at gmail.com
Wed Jun 8 07:07:45 UTC 2022


On Wednesday, 8 June 2022 at 06:56:50 UTC, Walter Bright wrote:
> On 6/7/2022 5:47 AM, forkit wrote:
>> Instead, it deliberately, intentionally, proudly, leaves this 
>> important aspect in software development to the programmer(s).
>
> Yeah, well, the alternative is "friend" classes, which are an 
> abomination.
>
> The unit of encapsulation in D is the module, not the class.

But the abomination, is what you already have ;-)

Cause *everything* is a friend. It can't get much worse than that.

But wait, it does get worse ...  you (the programmer) got no say 
it.

You cannot unfriend in D (except through a series of silly 
workarounds, that even then, just give you 'the appearance' that 
you've unfriended - they still your friends, should they ever 
show up on the scene.

You got not say it. That's the real 'abomination'.



More information about the Digitalmars-d mailing list