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

--- Comment #7 from timon.g...@gmx.ch ---
(In reply to elpenguino+D from comment #6)
> (In reply to Bolpat from comment #5)
> > (In reply to elpenguino+D from comment #1)
> ...
> An assertion is just an enforced assumption. They both mean the same thing.
> ...

They are dual. An assertion is a proof obligation, an assumption is an axiom.

It's more obvious in a verifier. Standard definitions in Hoare logic:

{ P ∧ Q } assert(P) { Q }
{ Q } assume(P) { P ∧ Q }

In D, `assert` is `@safe`, `assume` has to be `@system`. You can't do hard
optimizations based on unchecked assumptions (in particular in `@safe` code)
while following the D specification, any flag that does so deviates from the
specification of `@safe`. This is why this enhancement is important, it enables
actually giving `@trusted` optimization hints in a sound manner.

--

Reply via email to