[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to access the most current environment in T?
In article <53777@yale-celray.yale.UUCP>, Ram-Ashwin@cs (Ashwin Ram) writes:
>In article <53702@yale-celray.yale.UUCP>, ayang@pulsar.cs.yale.edu (allan yang) writes:
>>
>> In T version 3.1, is there a way to access the most current environment?
>>
>> More specifically, given
>>
>> (let ((x 'y) (y 1)) (eval x *most-current-env*))
>>
>> I want the body be evaluated to 1. User-env does not contain the most
>> recent binding of y.
>
>Try (THE-ENVIRONMENT):
>
> > (let ((x 'y) (y 1)) (eval x (the-environment)))
> 1
This doesn't seem to work in compiled code:
> (let ((x 'y) (y 5)) (eval x (the-environment)))
5
> (orbit '(let ((x 'y) (y 5)) (eval x (the-environment))))
;** Warning: unreferenced variable Y
; Location: in (LET ((X (QUOTE Y)) (Y 5)) (EVAL X (THE-ENVIRONMENT)))
** Error: variable Y is unbound
>>
The same error occurs if stuff is added to refer to X and to make the EVAL
call non-tail recursive.
Bruce