[plt-scheme] repl

From: Gregory Cooper (greg at cs.brown.edu)
Date: Sat Sep 16 22:11:00 EDT 2006

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.