assert semantic change proposal

via Digitalmars-d digitalmars-d at puremagic.com
Wed Aug 6 06:31:53 PDT 2014


On Wednesday, 6 August 2014 at 12:41:16 UTC, Artur Skawina via 
Digitalmars-d wrote:
> The compiler can /assume/ that the condition never fails. 
> Hence, it does
> not need to generate any code to check that the assumption is 
> valid.

Exactly, worse example using a coroutine:

«
label:
…
while(running) { // forevah!
    … yield …
}
…
assume(anything local not assigned below label) // reachable, but 
never executed
»

is equivalent to:

«
assume(anything local not assigned below label) // optimize based 
on this
label:
…
while(running) {
    … yield …
}
»

Woops?


More information about the Digitalmars-d mailing list