[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Implement `the-environment' and `local-eval' in evaluator

From: Hans Aberg
Subject: Re: [PATCH] Implement `the-environment' and `local-eval' in evaluator
Date: Fri, 16 Dec 2011 17:59:13 +0100

On 16 Dec 2011, at 16:27, Mark H Weaver wrote:

> As an interesting case, suppose that you define the following macro in
> module A:
> (define foo 'module-a)
> (define-syntax alt-environment
>  (syntax-rules ()
>    ((_) (the-environment))))
> and then evaluate the following within module B:
> (define foo 'module-b)
> (local-eval 'foo (alt-environment))
> What should the result be?
> My guess is that it should return 'module-a, because I think
> conceptually it should act as though the local-expression passed to
> `local-eval' were put in place of (the-environment), wherever that
> might be.
> Thoughts?

I thought it should be a way to capture the environment when (the-environment) 
is evaluated, returning a reference to it. So
  (define foo 'module-a)
  (define bar (the-environment))  ; Capture environment, and save reference in 
Now in
  (define foo 'module-b)
  (local-eval 'foo bar)
bar refers to the captured environment and 'foo is inserted into that; that is 

It would need to capture all dynamic syntactic rules as well, otherwise the 
code cannot be run safely.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]