https://issues.dlang.org/show_bug.cgi?id=17226

kinke <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #8 from kinke <[email protected]> ---
(In reply to Paul Backus from comment #7)
> Perhaps the simplest way to fix this is to have assert(condition, message)
> evaluate the message *first*

No. Changing the evaluation order would have a deep impact:

* Side effects of evaluating the msg first might change the assert condition's
outcome.
* You don't want a potentially expensive msg expression to be evaluated
unconditionally, i.e., including the regular case where the assertion holds.
* The msg expression may depend on the state after a failed condition - e.g.,
`assert(x.trySomething(), x.getLastErrorMsg())` (horrible, I know...).

--

Reply via email to