Adding a new design constraint to D

Salih Dincer salihdb at hotmail.com
Tue Jun 14 07:12:18 UTC 2022


On Tuesday, 14 June 2022 at 05:43:49 UTC, forkit wrote:
> [...]
> So the only logical outcome of this discussion, is whether the 
> benefit of adding a design constraint *option* to the language, 
> outweighs the cost of adding it to the langauge.
>
> The benefits of adding this feature appear to be self-evident.
>
> So ultimately, this comes down to a benefit-vs-cost 
> consideration.
>
> The cost of adding it to the language, is less self-evident.
>
> Is the cost, the unjustified cognitive burden of having both 
> 'private' and 'private(scope)', instead of just 'private'?
>
> Is the cost - it's just too complicated to change the compiler 
> source to accomodate this option?
>
> What do you think the cost of adding such a feature is?

If the object in the same module is visible, why make it private 
when you're already writing code? You are already partially 
isolating using underscore (Foo._id). For example, Foo.length 
will never conflict.

What difference would it make to see or not see this error?

> Error: no property `id` for type `source.Foo`


More information about the Digitalmars-d mailing list