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

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Tue Jun 7 09:17:17 UTC 2022


On Tuesday, 7 June 2022 at 09:09:52 UTC, zjh wrote:
> On Tuesday, 7 June 2022 at 09:05:36 UTC, Ola Fosheim Grøstad 
> wrote:
>
>> TLDR; I strongly disagree.
>
> `Class encapsulation` is a must for ordinary `c++ people`!

I am «ordinary C++ people». I also learned OOP from the people 
who created OOP! I should be terribly biased towards Simula's 
take on «private», but I am not. Why?

Encapsulation is just a reminder. Encapsulation has no effect on 
the final executable. This is why Beta could take encapsulation 
out of the language semantics and do it on the level of the 
language grammar through what they called «the fragment system» 
(or something like that).

> I am not an expert. I only know that `class encapsulation` is 
> very cool, at least more comfortable than `module 
> encapsulation`.

Pick up a book on language design, it is fun to read about, and 
you seem interested! Then we can talk more. (Without basic 
knowledge about language design principles it is easy to reach 
conclusion that has proven to be not so good).



More information about the Digitalmars-d mailing list