Misleading contract syntax

Michel Fortin michel.fortin at michelf.com
Thu Mar 4 11:18:56 PST 2010


On 2010-03-04 13:19:25 -0500, Norbert Nemec <Norbert at Nemec-online.de> said:

> Exactly my point: contracts are not assertions.
> 
> Still, contracts are not exceptions either. A broken contract is a BUG. 
> A triggered exception is a run-time condition that can happen in a 
> perfectly correct program.

I think a big problem today is that "in" contracts are enforced as part 
of the function. They should be checked at the call site because "in" 
contract check for bugs in the calling code. That would make all entry 
points to a library validated when the calling code is compiled in 
debug mode, even if the library is compiled in release mode.


-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list