alwaysAssert() [was: Against enforce()]

dsimcha dsimcha at yahoo.com
Thu Mar 17 16:38:52 PDT 2011


On 3/17/2011 7:12 PM, Walter Bright wrote:
>
> Sure, but there is plenty wrong with using enforce() for bug detection
> even if alwaysAssert does not exist. For one thing, such uses encourage
> others to misunderstand and misuse enforce.
>
> Additionally, alwaysAssert is an obvious one liner. I think such things
> need to be very frequently used to consider them part of the standard
> library. Otherwise, we risk Phobos becoming a morass of trivia.

What makes you think it wouldn't be used very frequently?  It seems 
silly to me to turn off asserts in non-performance-critical bits of code 
just because I don't want bounds checking or the more expensive asserts.


More information about the Digitalmars-d mailing list