[racket] metacircular interpreter, lexical scope, environment

From: David Van Horn (dvanhorn at ccs.neu.edu)
Date: Wed Dec 1 22:34:48 EST 2010

On 12/1/10 10:14 PM, Hendrik Boom wrote:
> On Wed, Dec 01, 2010 at 09:09:04PM -0500, David Van Horn wrote:
>> On 12/1/10 9:03 PM, YC wrote:
>>> Thanks - I have read the substitution part of PLAI and thought of using
>>> substitution as well, but it seems that substitution does not constitute
>>> the full solution:
>>>
>>>      * it only work with side-effect free code
>>
>> This is not entirely true, but substitution and effects are subtle.
>
> The actual prblem is that the parameter is reevaluated every time it's
> used in teh called function.  THis lacke efficiency, but occasionally
> (as in Algol 60's call-by-name it's exactly what you need,)
>
>>
>>>      * it does not address closure
>>
>> You don't need closures in a substitution model.
>
> No, as long as you take care to use systematic renaming of variables.

You luck out and get to avoid this issue if you implement a 
call-by-value language.

David


Posted on the users mailing list.