Sealed classes - would you want them in D? (v2)
KingJoffrey
KingJoffrey at KingJoffrey.com
Fri May 18 12:42:05 UTC 2018
On Friday, 18 May 2018 at 12:32:30 UTC, Mike Parker wrote:
>
> private(this) int y;
>
I think that might be it. So clean.
> This keeps the implementation simple and the scope focused. If
> a DIP were put forward, I think this would be the approach to
> take. Though a fairly strong case will still need to be made as
> to why this is beneficial (use cases, example code, etc). To
> bolster the case, I would look at the reasoning behind the
> recommendation in Java that classes use the public API
> internally rather than manipulating member variables directly
> to improve maintainability.
How hard is it to convince people, that being able to have the
compiler detect semantic errors that break your defined interface
is actually a good thing. I mean really. I've had this capability
in major languages for decades.
Let D empower the programmer in this case, by giving that back to
them (as an opt-in)
More information about the Digitalmars-d
mailing list