Using closure in function scope to make "real" private class members
Mike Parker
aldacron at gmail.com
Sat Jun 4 01:41:52 UTC 2022
On Friday, 3 June 2022 at 22:50:06 UTC, forkit wrote:
> On Friday, 3 June 2022 at 15:41:04 UTC, Mike Parker wrote:
>> On Friday, 3 June 2022 at 12:13:47 UTC, forkit wrote:
>>
>>>
>>> Practically speaking, anyone that uses a class in D, must be
>>> put it in its own module - no exceptions.
>>
>> That's just nonsense.
>
> How is it nonsense? I don't get it.
"anyone that uses a class in D...no exceptions"
Change that to "anyone who wants class-level encapsulation" and
remove the "no exceptions" and it's sensible.
>
> I do not see why their would be such a strong objection to
> giving the programmer an alternative approach. That seems
> 'ideological' to me.
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.
More information about the Digitalmars-d
mailing list