We had a student essentially accidentally write a program like this (their version didn't have the counter -- I added that to be able to see how many times it was calling f):
var thecount = 0
fun g():
f()
where:
g()
end
fun f() block:
thecount := thecount + 1
check:
g()
end
end
We tell them not to use check, but they use LLMs, and LLMs seem to think that's how you write tests in Pyret. Go figure.
What's interesting is that this does not infinite loop, even though it seems like it maybe should -- i.e., the g where block is the only top level test, so it runs, calling g(), which then invokes f(), which then causes the check block inside of f() to run, which then causes g() to run, which calls back to f(), and so on.
Instead, I get a non-deterministic number of calls -- the couple times I ran it I got numbers like 1800, 2200, 2500, etc.
Not really sure what's going on!