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

Commander Zot no at no.no
Sat Jun 4 14:23:42 UTC 2022


On Saturday, 4 June 2022 at 14:08:24 UTC, zjh wrote:
> On Saturday, 4 June 2022 at 13:56:07 UTC, Ola Fosheim Grøstad 
> wrote:
>> On Saturday, 4 June 2022 at 13:41:43 UTC, zjh wrote:
>>> Language is inherently `complex`.
>>
>> Well, that is a problem, as the main selling point is to be 
>> simpler than C++!!
>
>
> If you want to meet the needs of `more and more` users, you 
> must be `complex`.
> Otherwise, you are cheating.

class private does not provide anything you can not already 
express in D.
if you don't want access to you class, put it in it's own module 
where it belongs.
but really this problem should not arise in the first place, 
because you should use interfaces anyway. a class should be an 
implementation detail.
if anything we could add the ability to declare multiple modules 
in one file, but i'm not a fan of that either.


More information about the Digitalmars-d mailing list