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

forkit forkit at gmail.com
Sat Jun 4 00:41:24 UTC 2022


On Friday, 3 June 2022 at 23:30:58 UTC, Steven Schveighoffer 
wrote:
> On 6/3/22 6:50 PM, 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.
>
> I think he means the "no exceptions" is nonsense. There are 
> valid reasons to want to access private data from outside types.
>
> -Steve

First, this is not something I've argued against. I'm made no 
such argument that attempts to invalidate that point of view.

But his comment is very selective then, if that's what he meant, 
because my comments have been within the context of wanting 
static, compiler enforced, safety of the class. Which can only be 
done by putting every class in its own file. No exceptions.


I'm arguing to give the programmer another option, not take an 
option way.



More information about the Digitalmars-d mailing list