On 3/16/2011 6:53 PM, bearophile wrote:
Right. But saying just that is not enough. You have to add that such "if
(!condition) throw new Exception(args)" idiom is common in Phobos because
Phobos is present only in release mode. If the zip distribution of DMD
contains two Phobos and dmd becomes able to use the right one according to
the compilation switches, then I think that "if (!condition) throw new
Exception(args)" will become more rare, and the enforce() too will be less
commonly needed.


I must reiterate that enforce() is NOT FOR DETECTING PROGRAM BUGS. Therefore, enforce() must not change its behavior based on "release mode" or other compiler switches.

Contracts and asserts are for program bug detection. NOT enforce.

This distinction is critical.

Reply via email to