wybe icon indicating copy to clipboard operation
wybe copied to clipboard

Infinite loops do not have the correct `terminal` determinism

Open jimbxb opened this issue 3 years ago • 1 comments

As mentioned in #293

def {terminal} foo {
    do { pass }
}

This code compiles with the following error:

scratch/test.wybe:1:1: foo has normal (total) determinism, but declared terminal

However, the loop cannot actually terminate, hence it is a terminal loop and a terminal proc

jimbxb avatar May 11 '22 00:05 jimbxb

It wouldn't be too hard to handle this for loops, but infinite recursions have the same problem. That's not too hard to handle, either, but it requires a fixed point analysis, so it would slow compilation. More importantly, we analyse determinism top-down in bodies, so that we can point to the part of the code that has the wrong determinism, rather than bottom-up, determining a proc's determinism from its code. Fixing this problem would require giving up specificity in determinism errors, or computing terminal determinism bottom-up to a fixed point, and other determinisms top-down. I think the latter is the right approach.

pschachte avatar Jul 07 '22 05:07 pschachte