[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Implement local-eval, local-compile, and the-environment
From: |
Andy Wingo |
Subject: |
Re: [PATCH] Implement local-eval, local-compile, and the-environment |
Date: |
Sat, 14 Jan 2012 16:58:54 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) |
Hi Mark,
On Sun 08 Jan 2012 21:39, Mark H Weaver <address@hidden> writes:
> Andy Wingo <address@hidden> writes:
>> I guess it's not clear to me why you would want to force expression
>> context.
>
> If we allow definitions, then your nice equivalence
>
> <form> == (local-eval '<form> (the-environment))
>
> no longer holds. Also, the user cannot use the simple mental model of
> imagining that <form> had been put in place of (the-environment).
>
> For example:
>
> (let ((x 1))
> (define (get-x) x)
> (begin
> (define x 2)
> (get-x)))
> => 2
>
> is _not_ equivalent to:
>
> (let ((x 1))
> (define (get-x) x)
> (local-eval '(begin
> (define x 2)
> (get-x))
> (the-environment)))
> => 1
>
> The only way I see to achieve your equivalence is to constrain <form> to
> be an expression.
Ahh, yes indeed. Thanks for the example.
Another (less clear) way to say this would be to note that it's not
possibly to incrementally build up a set of recursive bindings.
Or, another try: local-eval cannot be allowed to affect the resolution
of variables already in the environment. Therefore it does not capture
an open set of mutually recursive bindings.
I'm not doing very well at describing it, but your example was very
good.
What about the-environment outside of a lexical contour, though? Does
that permit definitions? Should it?
Andy
--
http://wingolog.org/
- Re: [PATCH] Implement local-eval, local-compile, and the-environment, (continued)
- Re: [PATCH] Implement local-eval, local-compile, and the-environment, Mark H Weaver, 2012/01/03
- Re: [PATCH] Implement local-eval, local-compile, and the-environment, Andy Wingo, 2012/01/07
- Re: [PATCH] Implement local-eval, local-compile, and the-environment, Mark H Weaver, 2012/01/07
- Re: [PATCH] Implement local-eval, local-compile, and the-environment, Andy Wingo, 2012/01/07
- Re: [PATCH] Implement local-eval, local-compile, and the-environment, Mark H Weaver, 2012/01/08
- Variables and the evaluator (Was: [PATCH] Implement local-eval, local-compile, and the-environment), Andy Wingo, 2012/01/14
- Re: Variables and the evaluator, Andy Wingo, 2012/01/14
- Re: [PATCH] Implement local-eval, local-compile, and the-environment,
Andy Wingo <=
- Re: [PATCH] Implement local-eval, local-compile, and the-environment, Andy Wingo, 2012/01/14