Feedback on Átila's Vision for D

Adam D. Ruppe destructionator at gmail.com
Sun Oct 20 00:00:45 UTC 2019


On Saturday, 19 October 2019 at 23:38:51 UTC, aliak wrote:
> Furthermore, neither solution allows you to completely 
> encapsulate some vars in a type while allowing module functions 
> to access others that are not accessible outside the module.

You could still use interfaces for a total separation, even 
inside a module (well, unless a cast is used, but meh). Or opaque 
structs.

Someone on Stack Overflow this week asked me if we can do 
Javascript style fake modules in D, where the "private" members 
are local inside the function and the "public" ones are returned 
in the object... and indeed we can, which is another amusing way 
of achieving it, but even I think that is a bit too silly in D.


I personally wouldn't vote against adding like private(class) - 
such could be done without massive breakage - but I'm totally meh 
on the whole debate.


More information about the Digitalmars-d mailing list