David Kastrup <d...@gnu.org> 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