TyOverby / ares

A Lisp made for easy integration with Rust.
9 stars 1 forks source link

context env stack needs rethunk #47

Closed bwo closed 8 years ago

bwo commented 8 years ago
    pub fn env(&self) -> &Env {
        let &LoadedContext { ref ctx, ref env_stack, ..} = self;
        env_stack.last().unwrap_or(&ctx.env)
    }

does the wrong thing in combination with with_other_env: you have the right environment in self.ctx.env, but it isn't actually found. (Illustrated by ((lambda () (let (x 1) x))).)

Dunno of if the right thing to do is push the new env onto the stack and then pop it, or replace the top of the stack, or what.

TyOverby commented 8 years ago

I think the right thing to do is push on the stack and pop back off. Thanks for the bug report, I can't believe we didn't have a test for this!