[Issue 6278] Regression(2.054 beta): 'in' contract inheritance doesn't work with safe code

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 1 00:46:37 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=6278



--- Comment #10 from Walter Bright <bugzilla at digitalmars.com> 2012-02-01 00:46:33 PST ---
(In reply to comment #9)
> Exceptions thrown in contracts are supposed to be recoverable,

No, they are supposed to exit the program. The thing with in contracts is not
that they're recoverable, it's that they assume that a failing in contract is
not leaving the program in an invalid state.

I agree this is a hole in the safety system, which is why I'm not closing it.
I'm just getting it to not be a regression. I do not know what a completely
correct fix would look like at the moment.

One possibility would be to allow only pure code in a contract. Pure code
cannot modify global state, and so when it throws it wouldn't be leaving
something outside of the contract in an invalid state.

We've talked about making in/out contracts pure before, I've been concerned
that they'd be too restrictive. Maybe require them to be pure when in safe
mode?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list