On Saturday, 12 May 2018 at 00:39:29 UTC, Mike Parker wrote:

Again, they're in the same module. From an encapsulation stand point, what does it matter that private members are within or without any specific set of curly braces? It only matters if you want to adhere to a purely conceptual view of encapsulation. From a practical view, it matters not one whit.



It matters, in the same sense, that it matters if you have a module, full of functions (which are encapsulated units of code), but your module has a whole bunch of goto statements (not necessarily within a function). Now...you've essentially no idea now which functions are truly encapsulated, and which aren't. You now have to take into view, 'the whole module' - which goes against the very principle of problem solving by breaking down the problem into smaller pieces.

I have looked a D source code modules. I challenge anyone to get there head around whole modules.

In a similar vain to gotos, having classes (which are traditionally meant to be encapsulated units of code) in a module, but also having anything in the module (outside of the class[es]), having the capacity to do whatever it wants to the private parts of the class.

We're back in goto land!



Reply via email to