Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lisp: Rust eval() built-in should not invoke the expander #35

Open
jorendorff opened this issue Sep 1, 2017 · 0 comments
Open

lisp: Rust eval() built-in should not invoke the expander #35

jorendorff opened this issue Sep 1, 2017 · 0 comments

Comments

@jorendorff
Copy link
Owner

Very weird symptom: if you trigger a syntax error in the repl, then exit the repl, you get an extra error message.

» ()
error: car: pair required
» ^D
Error: #(error syntax error #<unspecified> ())

The cause is that the eval() builtin, which is implemented in Rust, calls the sc-expand procedure, which is written in Scheme, and sc-expand raises an error. The REPL's error handler invokes an escape continuation.

Now, if (eval) were written in Scheme, invoking that continuation would cause the (eval) stack frame to be discarded. But it's not. So we get this really weird behavior: the Scheme stack is replaced by the continuation, but the Rust stack is unaffected.

The root cause is that the stack has this pattern: Scheme -> Rust -> Scheme. In this case, the innermost Scheme code can call a continuation and get very odd behavior. We have to prohibit recursing into the interpreter.

@jorendorff jorendorff changed the title Rust eval() built-in should not invoke the expander lisp: Rust eval() built-in should not invoke the expander Sep 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant