guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bindings for free identifiers in (ice-9 syncase)


From: Neil Jerram
Subject: Re: bindings for free identifiers in (ice-9 syncase)
Date: Thu, 19 Mar 2009 20:28:49 +0000
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

Julian Graham <address@hidden> writes:

> This does strike me as a serious problem (and it's a spanner in the
> works for implementing R6RS libraries).  In effect, isn't the bug
> saying that Guile's syncase macros aren't totally hygienic?  That is,
> in my example, if you provide your own binding for `foo-function' in
> the REPL environment, then that will be used in the evaluation of the
> transformed expression instead of the one in `(foo-module)', which is
> certainly *not* the intent of the macro author.

Completely agree.  I don't think there's any doubt that current
behaviour is wrong.

> However, as a novice who's spent some time poking around in
> ice-9/boot-9.scm and `(ice-9 syncase)', I'm sort of confused about why
> this is hard -- isn't this metadata available?  The transformer should
> have access to the closure in which it was created, and at creation
> time, we certainly know which identifiers are free and which ones
> aren't -- and we can look up the variables bound to the free ones in
> the transformer's lexical closure.

The problem is some combination of

- how lexical identifiers are memoized (as a pair of numbers I, J,
  meaning the Ith variable in the Jth level up from the current
  lexical environment)

- the fact that at any given point, the evaluator is only aware of one
  lexical environment

- that the macro transformation process doesn't memoize top-level
  variables at the time of the transformation.

I would guess it's mostly the last point.

Regards,
        Neil




reply via email to

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