Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Leaking definitions #23

Closed
mwatts15 opened this Issue · 3 comments

2 participants

@mwatts15
Owner

Definitions are being lost during interpretation:

(markw@envy)(zsh:2)(/v/filer4b/v38q001/markw/cs345/proj/crono)
(1160)% ./crono.sh -T                                                                                        23:38
Crono++ by Mark Watts, Carlo Vidal, Troy Varney (c) 2012

> (load "prelude.lisp")
Visiting (load prelude.lisp)
  Visiting load
    Result: load
  Visiting prelude.lisp
    Result: prelude.lisp
  Result: #t
Result: #t
> (prFoldr + 1 '(1 2 3))
Visiting (prFoldr + 1 '(1 2 3))
  Visiting prFoldr
    Result: (\ (fn z x) (<Y> (<B> (<COND> (= Nil) (<K> z)) (<B> (<S> (<B> fn (car))) (<C> <B> cdr))) x))
  Visiting +
    Result: +
  Visiting 1
    Result: 1
  Visiting '(1 2 3)
  Visiting (1 2 3)
    Result: (1 2 3)
    Result: (1 2 3)
Invalid Function Application: g is not a function in (g x)
vvvvvvvvvHEREvvvvvvvvvv
> (prFoldr + 1 '(1 2 3))
Invalid Function Application: prFoldr is not a function in (prFoldr + 1 '(1 2 3))
^^^^^^^^^^^^^^^^^^^^^^^^^
> 

and even more disturbing

> (+ 2 3)
Result: (+ 2 3)
> (+ 2 3 4)
Too many arguments to +: 3/2 recieved
> (+ 2 3)
Result: (+ 2 3)
>

First guess is unmatched push/popEnv()

@mwatts15
Owner

Tracing environment pushes and pops doesn't reveal anything.

@tvarney
Collaborator

It's probably because the interpreter doesn't reset any modified options when throwing an exception. EvalType is the offender in this case.

@tvarney
Collaborator

Yep, adding a line to set the eval variable back to it's saved value fixed this. Closing.

@tvarney tvarney closed this
@tvarney tvarney referenced this issue from a commit
Troy Varney Fixed Issue #23. Interpreter now correctly resets state when throwing an
exception. Also fixed trace messages using toString instead of repr.
65ea623
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.