Using closure in function scope to make "real" private class members
forkit
forkit at gmail.com
Fri Jun 3 09:50:20 UTC 2022
On Wednesday, 1 June 2022 at 12:24:23 UTC, Dukc wrote:
>
> ...
> Controlling the scope of encapsulation is rarely that critical,
> and if it is, it's easier to just put the class to it's own
> file.
Actually, controlling the scope of encapsulation is *critical* to
managing complexity.
Due to everything within a module being a (C++ like) 'friend' to
any class within that module, the ONLY way to manage the
complexity of a D module, in the case where object oriented
design is in play, is by doing what you say - put each class in
it's own module.
Fine.
I'd like to audit the D source code, to see if that is actually
what happens when programmers have access to the flexible,
friendly, D module ;-)
Otherwise, encapsulation is compromised.
More information about the Digitalmars-d
mailing list