Thoughts about in contract inheritance

Stewart Gordon smjg_1998 at yahoo.com
Wed Feb 29 10:06:01 PST 2012


On 29/02/2012 17:01, Timon Gehr wrote:
<snip>
> The official website, d-programming-language.org or dlang.org. You have to click on "See
> example". It is at the first bulb of "Power".

But the comment "// <-- assumed to inherit contract" isn't actually there, so what's 
"quite explicit" about it?  Besides, the interface declaration there isn't allowed by the 
grammar.

<snip>

> Language level contracts as in D are (basically) a way to introduce runtime checks into
> interfaces. If the interface is redefined then that potentially breaks all code that
> implements the interface, even if this is not explicitly stated in form of contracts.

You mean the fault lies on the part of the library creator for widening the in contract of 
a non-final method?

<snip>
> Obviously there can be additional changes without redefining what an existing part of the
> API does.
<snip>

So you consider illegal inputs to a function to be part of the API?

Stewart.


More information about the Digitalmars-d mailing list