std.locale

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Mar 3 07:05:51 PST 2009


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.

Andrei



More information about the Digitalmars-d mailing list