Scope modules DIP rough messy draft.

12345swordy alexanderheistermann at gmail.com
Mon Oct 29 15:50:33 UTC 2018


On Monday, 29 October 2018 at 15:00:07 UTC, Stanislav Blinov 
wrote:

> So? You, the programmer, are breaking encapsulation here by 
> accessing 'private' member.
There is no encapsulation break, as it located in the same 
module. The encapsulation that you speak of is human enforced.

> That'd be interesting to see. Why didn't you put those supposed 
> limitations in there to begin with? I.e. what's the purpose of 
> this "messy draft"?
To get feedback. Which allows me to spot things that need 
revisiting or need better explaining. This isn't the final draft. 
Not by a long shot.


> Global variables aren't accessing anything. You (the 
> programmer) are, by assigning values to them.
That counter point doesn't make any sense. You act like that I am 
arguing that they are intelligent or something.


> That's not an issue with encapsulation at all. That's a 
> lifetime issue.
Not my point. The point is that the compiler won't complain that 
you are getting the local variable in the function from outside 
the function, irregardless that you set it to private or not and 
will compile just as fine.


>> Nested classes/functions are not encapsulated. The module 
>> itself is the unit of encapsulation.
>
> You're confusing encapsulation and scopes now:
*shrugs*
  The other user treat them as one as the same.




More information about the Digitalmars-d mailing list