Inheritance of purity

Timon Gehr timon.gehr at gmx.ch
Sat Feb 25 03:40:36 PST 2012


On 02/24/2012 01:41 PM, deadalnix wrote:
> Le 18/02/2012 19:25, Walter Bright a écrit :
>> On 2/18/2012 6:49 AM, kenji hara wrote:
>>> After some thoughts, I agree that inheritance of pure @safe, and
>>> nothrow is good feature.
>>> But I disagree to const inference, because const attribute interacts
>>> with overloadings.
>>
>> The const inheritance *only* happens if otherwise you'd get a covariance
>> error. It does not change the meaning of any existing code that compiled
>> successfully.
>
> yes but then, if a method is added to the base class, you will have a
> changement of behavior of all overriden method, silently.
>

No. The compiler will explode in your face.

> It means nasty bugs, an hours spent to go throw the whole codebase and
> review manually which method do we want to override in each cases.
>
> The current state of D is very inconsistent on this topic and it lead to
> many quirks.

Not at all.

Have you actually experienced such problems? D is explicitly designed to 
avoid this kind of scenarios.


More information about the Digitalmars-d mailing list