`restricted` member variables

forkit forkit at gmail.com
Thu Jun 23 05:51:47 UTC 2022


On Thursday, 23 June 2022 at 05:41:19 UTC, Ola Fosheim Grøstad 
wrote:
>
> Stronger typing is desirable in complex performance oriented 
> system level programming. This is the biggest weakness of C. 
> Modules are clearly weaker than class/struct level protection. 
> Weaker typing is not better in this context.
>
> But «private(this)» is inconsistent and ugly. Other languages 
> being ugly is not a good excuse. Most fields should be marked 
> class private and that makes this uglieness a burden.

Well, strong typing is the foundation of structured programming.

And structred programming is the foundation of scalable 
programming.

So I'd argue is more that 'desirable'. It's actually necessary.

Even Javascript has realised this recently. It's more powerful 
than D now, as far as strong typing goes! I never thought I'd say 
that...yeepers!

But really, the burden of typing this, just once in your class:

private(this):

seems pretty trivial to the burden of putting every class in its 
own module, just to simulate a strong type.




More information about the Digitalmars-d mailing list