[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] local-eval, local-compile, and the-environment (v3)
From: |
Mark H Weaver |
Subject: |
Re: [PATCH] local-eval, local-compile, and the-environment (v3) |
Date: |
Sun, 15 Jan 2012 14:06:01 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) |
David Kastrup <address@hidden> writes:
> Mark H Weaver <address@hidden> writes:
>
>> David Kastrup <address@hidden> writes:
>>
>>> Mark H Weaver <address@hidden> writes:
>>>
>>>> David Kastrup <address@hidden> writes:
>>>>
>>>>> I am not sure that the reasons for not permitting definition context in
>>>>> local-eval are not of somewhat more theoretical than practical nature,
>>>>
>>>> There's at least one practical reason not to allow it, namely that it is
>>>> _impossible_ to implement. Consider this:
>>>>
>>>> (let ((x 1))
>>>> (define (get-x) x)
>>>> (the-environment))
>>>>
>>>> If we allow (the-environment) to add definitions to the implicit
>>>> `letrec',
>>>
>>> Then just let's not allow it. Consider the body of local-eval to be
>>> wrapped inside of an implicit (begin ...).
>>
>> I think you mean an implicit (let () ...). If that's what you want,
>> then you can do it yourself, and the result will be less likely to
>> confuse.
>
> What is confusing here? "Obviously, definitions made in the scope of
> local-eval can't retroactively affect the environment where
> the-environment was called." And now instead of continuing with the
> unfriendly "For this reason, they are prohibited." we continue with "You
> may consider the local-eval body as being wrapped inside of an implicit
> (let () ...)."
If you want to include local definitions, then you'll need to wrap the
form passed to `local-eval' within (begin ...) anyway. If you're doing
that, why not just wrap them in (let () ...) instead? Is it really more
work to type #`(let () #,@forms) than #`(begin #,@forms) ?
I would like for users to be able to use the simple mental model that
the local expression is simply put in place of (the-environment).
I'd also like to achieve the following source-level equivalence:
<expr> == (local-eval '<expr> (the-environment))
You are suggesting that we wrap the expression within a (let () ...),
for the dubious benefit of allowing you to wrap the local forms in
(begin ...) instead of (let () ...).
I don't see any compelling benefit to this. On the other hand, I see
less elegant semantics and potential confusion among users, who might
reasonably expect the definitions in their (begin ...) to be added to
the implicit `letrec', as would happen if the (begin ...) were put in
place of (the-environment).
Mark
- [PATCH] local-eval, local-compile, and the-environment (v3), Mark H Weaver, 2012/01/15
- Re: [PATCH] local-eval, local-compile, and the-environment (v3), David Kastrup, 2012/01/15
- Re: [PATCH] local-eval, local-compile, and the-environment (v3), Mark H Weaver, 2012/01/15
- Re: [PATCH] local-eval, local-compile, and the-environment (v3), David Kastrup, 2012/01/15
- Re: [PATCH] local-eval, local-compile, and the-environment (v3), Mark H Weaver, 2012/01/15
- Re: [PATCH] local-eval, local-compile, and the-environment (v3), David Kastrup, 2012/01/15
- Re: [PATCH] local-eval, local-compile, and the-environment (v3),
Mark H Weaver <=
- Re: [PATCH] local-eval, local-compile, and the-environment (v3), David Kastrup, 2012/01/15
- Re: [PATCH] local-eval, local-compile, and the-environment (v3), Mark H Weaver, 2012/01/15
- Re: [PATCH] local-eval, local-compile, and the-environment (v3), David Kastrup, 2012/01/15
- Re: [PATCH] local-eval, local-compile, and the-environment (v3), David Kastrup, 2012/01/15
- Re: [PATCH] local-eval, local-compile, and the-environment (v3), Mark H Weaver, 2012/01/16
- Re: [PATCH] local-eval, local-compile, and the-environment (v3), David Kastrup, 2012/01/16
- Re: [PATCH] local-eval, local-compile, and the-environment (v3), Mark H Weaver, 2012/01/16
- Re: [PATCH] local-eval, local-compile, and the-environment (v3), Mark H Weaver, 2012/01/16
- Re: [PATCH] local-eval, local-compile, and the-environment (v3), Mark H Weaver, 2012/01/16
- Re: [PATCH] local-eval, local-compile, and the-environment (v3), David Kastrup, 2012/01/16