--- Comment #7 from Michel Fortin <> 2011-07-10 
08:21:02 EDT ---
> Only the overridden contracts would throw ContractExceptions, the only way you
> would ever see them was if you did:
> [...]
> Which is just horrible.

But it would be legal, even in safe code. And it'd be inconsistent since it'd
work only in overriding contracts and not elsewhere, exposing an implementation

(And it has nothing to do with this bug. I think you should fill a bug about
other errors being caught by contracts and discuss all this there.)

> If we disallow scope(exit/failure) and try/catch inside in contracts assert(x)
> could be re-written to if (!x) goto contractfail; which bypasses exceptions
> altogether.

Wouldn't that lead to other problems? If you had a struct with a destructor as
a local variable inside your contract, that destructor will be called in an
implicit finally block, much like scope(exit), so disabling try/finally will
break that.

Beside, what do we gain by disabling this? I agree it'd a poor coding practice
to catch exceptions in contracts, but I don't think the language should try to
enforce that. It might even be useful if for some reason you need to debug your

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to