On Thursday, February 05, 2015 01:33:54 David Nadlinger via Digitalmars-d wrote: > On Thursday, 5 February 2015 at 01:09:15 UTC, Andrei Alexandrescu > wrote: > > Non-debug mode removes asserts statically. -- Andrei > > Using pre-/post-conditions allows the _caller_ to specify whether > the checks are run without recompiling the function body, at > least in theory.
In theory, yes. And then in blocks would provide some value outside of virtual functions. But as it stands, there is _zero_ semantic difference between void foo(int i) in { assert(i > 0); } body { ... } and void foo(int i) { assert(i > 0); ... } And unless we make some serious changes to how D functions are called, I don't see how it could possibly be otherwise. in and out blocks and invariants are not part of the function signature. They're implementation details that disappear when prototypes are used. So, while in principle, it would be great if assertions related to contracts were enabled or disabled by the caller, not only does it not work that way now, I have no idea how it even could work that way. - Jonathan M Davis