[plt-scheme] repl

From: Chongkai Zhu (czhu at cs.utah.edu)
Date: Sat Sep 16 22:18:32 EDT 2006

Before I send the first E-mail, I already tried.

The answer is negtive: you will get the same infinite loop.

Chongkai

----- Original Message ----- 
From: "Gregory Cooper" <greg at cs.brown.edu>
To: <czhu at cs.utah.edu>
Cc: <plt-scheme at list.cs.brown.edu>
Sent: Saturday, September 16, 2006 8:11 PM
Subject: Re: [plt-scheme] repl


>I think the way it's typically done is to capture the old value of
> current-eval and call it directly instead of eval:
> 
> ... (current-eval
>      (let ([orig-eval (current-eval)])
>        (lambda (e)
>          (orig-eval e ns)))) ...
> 
> Would something like that work?
> 
> Greg
> 
> On 9/16/06, Chongkai Zhu <czhu at cs.utah.edu> wrote:
>> The following code causes an infinite loop:
>>
>>
>> (define ns (make-namespace))
>>
>> (parameterize ((current-prompt-read read)
>>                 (current-eval
>>                  (lambda (e)
>>                    (eval e ns))))
>>    (read-eval-print-loop))
>>
>> The reason is that when doing the (eval e ne), the eval refers to the
>> (current-eval) again. Although the intension is simple: starting a repl
>> that eval in a specific namespace, it doesn't work this way.
>>
>> Of course I can copy the souce code of the read-eval-print-loop (it's
>> 35-line Scheme code), modify it by changing the (current-eval) in it.
>> But is there any better way?
>>
>> Thanks.
>>
>> Chongkai
>> _________________________________________________
>>   For list-related administrative tasks:
>>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>
>

Posted on the users mailing list.