`panic`ing in the interpreter
Nobody has claimed this yet.
- Dominant language
- Lean
- Stars
- 9.2k
- Forks
- 990
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 175
Description
@Kha when panic is evaluated by the interpreter, the execution is interrupted as expected.
However, all trace messages produced using dbgTrace are lost because the #eval command implementation redirects stdout to a buffer.
Not sure what the best fix is. Here are some alternatives:
1- We register finalizers for panic. Then, #eval can set a finalizer that just dumps any intermediate output to stdout before terminating the execution.
2- We throw a C++ exception at panic instead of aborting. We will leak memory, but #eval will be able to dump the output as trace messages, and then terminate the Lean process with a panic message.
3- We don't change panic, but the interpreter intercepts it and uses a different implementation. Example: store error message, and continue the execution with the "arbitrary" element. Pro: no leaks. Cons: the computation is nonsense after the first panic, and it may diverge.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the #eval command implementation and the handling of panic and dbgTrace. Compare the three alternatives described in the issue, then determine how trace output can be preserved without leaving execution in an invalid state. Done means panic still terminates evaluation correctly and intermediate dbgTrace messages reach stdout.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100