Open pzinn opened 1 month ago
To make sure I understand, the problem is that try
isn't catching the errors occurred during TCO, right? e.g. things look fine without try:
i27 : f = t -> (alarm 1; sleep t;); f 10
stdio:23:38:(3): error: alarm occurred
i29 : f = t -> (alarm 1; sleep t); f 10
stdio:24:37:(3): error: alarm occurred
I'm sure you've seen it, but the solution might be related to #2596 also.
I don't think this is the same bug as #2596, though experience fixing one might help with the other.
@DanGrayson (or anyone else) can you explain why eval(f:Frame,c:Code)
calls evalexcept
:
https://github.com/Macaulay2/M2/blob/ec9e9ac60ed4a8e791448942202f077a88a87e15/M2/Macaulay2/d/evaluate.d#L1616-L1621
and not just eval(c:Code)
? I guess I'm asking the same question as above, what is the purpose of evalexcept
?
There are already existing open issues with
alarm
, this I think is a new one:This issue is presumably related to tail call optimisation (?). Note that I already submitted a PR a while ago about tail call, namely https://github.com/Macaulay2/M2/pull/3144, but it does not impact the issue described above.
I traced the issue to two different places that
alarm
is triggered, both in evaluate.d, namelyevalraw
in the first case,evalexcept
in the second. I could try to fix something but first I would need to understand better the difference between these two functions. Note thatevalraw
has this commentpresumably suggesting I should notice something that I don't...