Why is D unpopular
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Mon Jun 13 11:00:17 UTC 2022
On Monday, 13 June 2022 at 10:55:36 UTC, Ola Fosheim Grøstad
wrote:
> On Monday, 13 June 2022 at 10:51:10 UTC, Mike Parker wrote:
>> And I'm arguing that this is exactly what we should expect
>> from private-to-the-module, since B is not declared in the
>> same module as the superclass, so it's neither unfinished nor
>> a bug.
>
> It breaks the sub-typing requirement.
>
> If you get more access by recasting a pointer to the super-type
> then the sub-typing relation cannot be satisfied.
>
> Hence, it is certainly broken. If it is not a bug, then it is
> broken by design. Which is no better.
Or to explain it in simple terms:
*A cast to a supertype should only imply additional restrictions.*
In this case the opposite happens. So this aspect of the type
system is broken.
More information about the Digitalmars-d
mailing list