guile-devel
[Top][All Lists]
Advanced

[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 12:14:52 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

David Kastrup <address@hidden> writes:
> I am not altogether comfortable with pushing a "temporary fix" for the
> sake of LilyPond when we'll get another behavioral change with the next
> version.

But there would _not_ be a behavioral change in the next version.
It would only be a change in the internal implementation.

> As far as I understand, this implementation could be pulled into a
> separate file and used for bridging the 2.0.0-2.0.3 gap.

Unfortunately, any implementation of `local-eval' requires changes to
psyntax.scm, which is not something that you could reasonably do as an
external package.

> 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 (get-x) cannot know which binding of `x' to use.  In
fact, it cannot lookup _any_ bindings, because absolutely any identifier
(even syntactic keywords) could be redefined within this implicit
`letrec'.

This means that it's impossible to compile or evaluate anything within
the body of the outer `let', which means it's not even possible to
evaluate (the-environment) itself.  So there's no way to run the code
above if we allow (the-environment) to add definitions.

     Mark



reply via email to

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