On 08/02/14 21:19, Walter Bright via Digitalmars-d wrote:
> On 8/2/2014 6:20 AM, Artur Skawina via Digitalmars-d wrote:
>> The bug was _introduced_ by the assert, the code was 100% correct.
> 
> Asserts are part of the code, and writing incorrect asserts is writing buggy 
> code.

This was about incorrect asserts from one part of the program infecting
other (correct) parts. Nobody is saying that such a program isn't buggy.
Most, if not all, programs have bugs. Your assert (re-)definition makes
the assert /assumptions/, which are unchecked in release builds, _override_
other explicit checks. A wrong assert is not necessarily less likely than
wrong code.

There's nothing wrong with `assume`, it's very useful for optimizations.
But it's too dangerous to tack `assume` onto `assert`. If they are kept
separate then it's at least possible to carefully audit every 'assume'.
People *will* use them for micro-optimizations, and they *will* make
mistakes.

artur

Reply via email to