mattwparas / steel

An embedded scheme interpreter in Rust
Apache License 2.0
1.1k stars 49 forks source link

eval! triggers a panic #238

Closed fominok closed 2 months ago

fominok commented 2 months ago

Hey, I'm not sure if it's the right way to evaluate sexps, but it seemed reasonable to report a panic occurred

λ > (eval! "(+ 1 2)")
thread 'main' panicked at crates/steel-core/src/steel_vm/engine.rs:957:50:
called `Result::unwrap()` on an `Err` value: SteelErr { repr: Repr { kind: FreeIdentifier, message: "#%function-ptr-table", span: Some(0..0), stack_trace: None } }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

P.S. Is there any way to evaluate a sexp received from read! ?

mattwparas commented 2 months ago

Thanks for opening the issue - I've looked into it and should have a fix shortly. The panic is mostly the result of some bit rot on this function in particular, needs some extra tests around it

Also - to answer your question, you can use run! to evaluate sexprs. They won't be evaluated in the same environment as the host though - but you can keep around an engine instance to evaluate against

mattwparas commented 2 months ago

Should be fixed by #239