`restricted` member variables

Dom Disc dominikus at scherkl.de
Thu Jun 23 10:30:20 UTC 2022


On Thursday, 23 June 2022 at 10:16:42 UTC, forkit wrote:

> strongly typed, abstract data object is perhaps, the single most
> important concept for good, scalable, software engineering.
>
> Sure, D has a 'workaround' where you can 'simulate' this.
This is no workaround. It's one of Ds basic design choices, and 
done so for reasons (the friend-problem), not accidentally.

> it's deficient. As soon as you add any code whatsover to the 
> module, the simulation dissolves.
You can prevent that from happening (supported by the OS!). Much 
better as you can prevent someone who has access to a module from 
changing one of the classes within it (there you have no chance 
at all).

I call that strong typed. Much, much stronger than with multiple 
classes within one file!

> I think missing this important feature was D's million 'user' 
> mistake (a million missing users because of it).
There is no feature missing.
And I still find the way D realizes the same as other languages 
do with class private much better. Far from a mistake.



More information about the Digitalmars-d mailing list