assert semantic change proposal

David Bregman via Digitalmars-d digitalmars-d at puremagic.com
Wed Aug 6 23:04:37 PDT 2014


On Thursday, 7 August 2014 at 03:54:12 UTC, Ola Fosheim Grøstad 
wrote:
> «The __assume(0) statement is a special case.»
>
> So, it does not make perfect sense. If it did, it would not be 
> a special case?

It doesn't have to be a special case if you define it in the 
right way - in terms of control flow. Then the interpretation of 
assume(false) as unreachable follows quite naturally:

instead of defining assume(x) to mean that x is an axiom, define 
assume(x) to mean that P=>x is an axiom, where P is the 
proposition that control flow reaches the assume statement.

so assume(false) actually means P=>false, or simply !P

and !P means !(control flow reaches the assume), as desired.


More information about the Digitalmars-d mailing list