Shortcut evaluation for hierarchy of in contracts

Daniel Murphy yebblies at nospamgmail.com
Sat Jul 2 19:59:31 PDT 2011


"David Nadlinger" <see at klickverbot.at> wrote in message 
news:iuodav$2n7s$1 at digitalmars.com...
> In any case, I consider the current implementation buggy, as having no in 
> contract in the superclass is different from having an empty in contract 
> there:
>
> ---
> class Foo {
>   void baz(int i) {}
> }
>
> class Bar : Foo {
>   override void baz(int i) in {
>     assert(i < 5, "I am triggered, but should not be.");
>   } body {
>     assert(i < 5, "I should be triggered instead of the contract.");
>   }
> }
>
> void main() {
>   auto bar = new Bar;
>   bar.baz(6);
> }
> ---
>
> David

There's a patch for this! 




More information about the Digitalmars-d mailing list