data LoopStatus:
| return(final-value)
| next-2(new-arg-1, new-arg-2)
end
and this use
fun loop-2(f, arg-1, arg-2):
r = f(arg-1, arg-2)
cases (LoopStatus) r:
| return(v) => v
| next-2(new-arg-1, new-arg-2) => loop-2(f, new-arg-1, new-arg-2)
end
end
are accepted without complaint, but this program
fun gcd(p, q):
for loop-2(a from p, b from q):
if b == 0:
return(a)
else:
next-2(b, num-modulo(a, b))
end
end
end
produces a "name is reserved" error for return. I feel like the data definition itself should not have been permitted, since at least straightforward ways of using it are not permitted.
In the following program, this definition
and this use
are accepted without complaint, but this program
produces a "name is reserved" error for
return
. I feel like the data definition itself should not have been permitted, since at least straightforward ways of using it are not permitted.