[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
bar.
Now in
(define foo 'module-b)
(local-eval 'foo bar)
bar refers to the captured environment and 'foo is inserted into that; that is
'module-a.
It would need to capture all dynamic syntactic rules as well, otherwise the
code cannot be run safely.
Hans
- Re: [PATCH] Implement `capture-lexical-environment' in evaluator, (continued)
- Re: [PATCH] Implement `capture-lexical-environment' in evaluator, David Kastrup, 2011/12/14
- Re: [PATCH] Implement `capture-lexical-environment' in evaluator, Mark H Weaver, 2011/12/14
- [PATCH] Implement `the-environment' and `local-eval' in evaluator, Mark H Weaver, 2011/12/16
- Re: [PATCH] Implement `the-environment' and `local-eval' in evaluator, David Kastrup, 2011/12/16
- Re: [PATCH] Implement `the-environment' and `local-eval' in evaluator, Peter TB Brett, 2011/12/16
- Re: [PATCH] Implement `the-environment' and `local-eval' in evaluator, David Kastrup, 2011/12/16
- Re: [PATCH] Implement `the-environment' and `local-eval' in evaluator, Mark H Weaver, 2011/12/16
- Re: [PATCH] Implement `the-environment' and `local-eval' in evaluator, Andy Wingo, 2011/12/16
- Re: [PATCH] Implement `the-environment' and `local-eval' in evaluator, Mark H Weaver, 2011/12/16
- Re: [PATCH] Implement `the-environment' and `local-eval' in evaluator, Mark H Weaver, 2011/12/16
- Re: [PATCH] Implement `the-environment' and `local-eval' in evaluator,
Hans Aberg <=
- Re: Anything better for delayed lexical evaluation than (lambda () ...)?, Andy Wingo, 2011/12/14
- Re: Anything better for delayed lexical evaluation than (lambda () ...)?, David Kastrup, 2011/12/14
- Re: Anything better for delayed lexical evaluation than (lambda () ...)?, Andy Wingo, 2011/12/14
- Re: Anything better for delayed lexical evaluation than (lambda () ...)?, David Kastrup, 2011/12/14
- Re: Anything better for delayed lexical evaluation than (lambda () ...)?, Andy Wingo, 2011/12/14
- Re: Anything better for delayed lexical evaluation than (lambda () ...)?, Mark H Weaver, 2011/12/14
- Re: Anything better for delayed lexical evaluation than (lambda () ...)?, David Kastrup, 2011/12/14
- Re: Anything better for delayed lexical evaluation than (lambda () ...)?, Mark H Weaver, 2011/12/14
- Re: Anything better for delayed lexical evaluation than (lambda () ...)?, David Kastrup, 2011/12/14
- Re: Anything better for delayed lexical evaluation than (lambda () ...)?, David Kastrup, 2011/12/14