On Jun 19, 2009, at 2:27 AM, Derick Eddington wrote:
On Thu, 2009-06-18 at 22:55 +0300, Abdulaziz Ghuloum wrote:
(define (unbound-identifier? x)
(and
(free-identifier=? x (datum->syntax a.ctxt (syntax->datum x)))
(free-identifier=? x (datum->syntax b.ctxt (syntax->datum
x))))))
That's clever, but it's broken:
oops.
It seems PLT and Ypsilon are broken about this because an unbound
a.cons
and a bound a.cons must not be free-identifier=?.
Actually, I didn't expect that definition to work at all for PLT and
Larceny since their notion of free-identifier=? is very different from
Ikarus's (w.r.t. phases of identifiers: whether a bound identifier in
level x is free-identifier=? to the same identifier bound in level y,
etc.), so, maybe you have to do
(import (for (prefix (rnrs) a.) (meta -1)))
in the two auxiliary libraries.
For ypsilon, there are definitely bugs: in t.ss, you see that "let"
is bound, while if you test for "cons", you find it unbound.
I'm thinking there should be a standard (or common and portable with
compat libraries) primitive identifier-bound? predicate.
We first need to establish if it can be implemented in pure R6RS or
not. In psyntax, it can be implemented as easily as:
(define (bound-identifier? id) (and (id->label id) #t))
or we can use the previous definition using generate-temporaries.
But I'm still curious about a portable and pure R6RS solution.
BTW, in Larceny, you cannot do something like
(when-unbound (x)
(define x ---))
It complains that "Definition of identifier that may have already
affected meaning of undeferred portions of body". This is allowed
by the report (with a "should" iirc).
Aziz,,,