On Sunday, 3 August 2014 at 15:06:56 UTC, Walter Bright wrote:
On 8/2/2014 1:06 PM, Artur Skawina via Digitalmars-d wrote:
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.
This seems contradictory. You say it is fine to have assume
affect optimization, i.e. insert bugs if the assumes are wrong,
Yes
but not fine to check at runtime that the assumes are correct?
No, it would be fine for assume to do runtime checks on debug.
I.e. The semantics you want assert to have, would be fine for
assume. But I'd also expect assume to be used much more
conservatively than assert. And the naming is much clearer this
way.