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

bauss jj_1337 at live.dk
Wed Jun 8 19:12:33 UTC 2022


On Wednesday, 8 June 2022 at 18:53:35 UTC, Walter Bright wrote:
> My experience with C++ and the "friend" class concept is it is 
> necessary for C++ because it has no notion of a module.
>
> D is much simplified by making the module the fence for 
> encapsulation. C++ favors a smaller number of large files, D is 
> designed around a larger number of small files.
>
> I understand that you don't prefer that approach, but I suspect 
> if you've used "friend" classes much in C++ you'd change your 
> mind. Most people find D's way a relief.

I think there are two sides of the coin.

Also I don't think it's necessarily that people have a problem 
with how D wants it, it's just that some of us would like the 
option to opt-out of it when needed.


More information about the Digitalmars-d mailing list