Tue, 03 Mar 2009 07:05:51 -0800, Andrei Alexandrescu wrote: > bearophile wrote: >> Daniel Keep: >>> So I put contracts on everything. Fantastic. I do a release compile, >>> and all that safety disappears. So only the debug build has contracts >>> enabled. But it's the release build, if it crashes, that I need help >>> diagnosing. >> >> A simple solution is to not use -release for the final version of the code, >> but this keeps array bound controls too. >> LDC may have already solved your problem, with extra compilation arguments >> that you can use to disable such controls independently from each other. >> It's not a fault of design by contract, it's just that the D compiler >> switches are lumped together. It seems a simple to solve problem. >> >> Bye, >> bearophile > > I agree. I'm having the same problem: I put a contract in there, I know > it's as good as assert. So I can't do e.g. input validation because in > most functions input must always be validated. I also know that > contracts are doing the wrong thing with inheritance and can't apply to > interfaces, which is exactly the (only?) place they'd be interesting. So > I send the contracts home and use assert, enforce, and unittest.
I'd really like to see enforce() as a built-in language feature. assert() doesn't help in way too many situations.
