Shortcut evaluation for hierarchy of in contracts

Timon Gehr timon.gehr at gmx.ch
Sat Jul 2 16:16:37 PDT 2011


Andrei Alexandrescu wrote:
> On 7/1/11 6:32 PM, Robert Jacques wrote:
>> No. I think the current behavior is correct. In fact, if anything, D
>> shouldn't allow you to define an in contract on any override method. A
>> Sub is a Base and therefore must be able to handle all inputs that are
>> valid for a Base.
>
> That is a sensible enhancement.
>
> Andrei

How so? The child class should still be able to take more general inputs than the
parent: by specifying an in contract on an override method.
How would you reach that goal otherwise?

Timon


More information about the Digitalmars-d mailing list