March 09, 2021 [Issue 21689] Contracts (in/out) is not checked when for interfaces methods | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21689 anonymous4 <dfj1esp02@sneakemail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |spec Status|NEW |RESOLVED See Also| |https://issues.dlang.org/sh | |ow_bug.cgi?id=21298 Resolution|--- |INVALID --- Comment #1 from anonymous4 <dfj1esp02@sneakemail.com> --- Umm, contract programming is a system with goals and rules to achieve those goals. If you want to make assertions without much metaphysics, you can do it with assert expression: interface I { int func(int x); } class CI : I { int func(int x) { assert(x > 0); return x*x; } } I agree with issue 21298, restriction of the contract in the subtype is a programming mistake and should be rejected by the compiler. -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply