Contract programming syntax
Stewart Gordon
smjg_1998 at yahoo.com
Thu Apr 9 02:05:54 PDT 2009
Michel Fortin wrote:
<snip>
> I believe the syntax should make the contracts part of the function
> signature, not part of the function body, because contracts are about
> expressing the function's interface. So I disagree with your proposed
> syntax which puts the contracts as part of the body.
<snip>
Finally, a counter-argument with which I agree. Moreover, having in/out
contracts as part of the function body suggests that they are part of
what is overridden. But the language doesn't quite work like that.
http://d.puremagic.com/issues/show_bug.cgi?id=302
http://www.digitalmars.com/d/archives/digitalmars/D/31595.html
Moreover, it ought to be possible to put contracts on abstract or
interface methods. This wouldn't fit in with contracts being in the body.
Stewart.
More information about the Digitalmars-d
mailing list