assume, assert, enforce, @safe

Tofu Ninja via Digitalmars-d digitalmars-d at puremagic.com
Thu Jul 31 21:40:07 PDT 2014


On Friday, 1 August 2014 at 03:45:55 UTC, Chris Cain wrote:
> If `assume` is implemented, the only sensible thing is to have 
> it verify the assumption under most circumstances and remove 
> the check (but keep the assumption for the optimizer to use) 
> under release code.
>
> Boom, done. Sorry guys, but it's the truth, the idea of 
> `assume` is worthless and dangerous if there doesn't exist any 
> way for it to actually check the assumption when you're trying 
> to debug your code. Walter is absolutely right on that.

I think you might actually be arguing for our side of the
argument but don't realize it.

Assume is an inherently unsafe and dangerous idea. Some have
pointed out that assume has potential usefulness in a VERY
limited set of cases, but I don't think anyone is arguing that is
not a dangerous thing.

Personally I think any form of assume sounds like a bad idea and
a very dangerous thing, that is why I (and others) are against
the idea of making assert act like assume in -release. It's not
that we are arguing for the addition of assume, it's that we
don't want assert to act like assume in -release. Our reaction to
the idea of making assert act like assume in -release is because
of the fact that assume IS so dangerous.

I don't think anyone is actually arguing for the addition of
assume.


More information about the Digitalmars-d mailing list