assert semantic change proposal
via Digitalmars-d
digitalmars-d at puremagic.com
Wed Aug 6 08:36:51 PDT 2014
On Wednesday, 6 August 2014 at 15:29:13 UTC, Ola Fosheim Grøstad
wrote:
> On Wednesday, 6 August 2014 at 15:02:10 UTC, Matthias Bentrup
> wrote:
>> is equivalent to
>>
>> while(running) {
>> ...don't assign to running, don't break...
>> }
>> assume(!running);
>
> You have to prove termination to get there? Plain Hoare logic
> cannot deal with non-terminating loops. Otherwise you risk
> proving any theorem below the loop to hold?
This is an assume, not an assert. The user tells the compiler
that `running` is false after the loop, it can thus conclude that
the loop will never run. So there is no non-terminating loop in
this case.
More information about the Digitalmars-d
mailing list