> I think the generate-temporaries way should be made to be portable > because identifiers which do not come from any lexical context should > not have any lexical context. What lexical context could they possibly > have which would make any sense? But it does seem hackish because > generate-temporaries wasn't intended for this. And likewise, using > free-identifier=? seems hackish because we're not actually interested in > comparing two identifiers.
The lexical context of the value returned by generate-temporaries could be the lexical context of the call to generate-temporaries. I think that is more consistent with section in the report describing generate-temporaries. (But I may be confused.) On Fri, Jun 19, 2009 at 6:43 PM, Derick Eddington<derick.edding...@gmail.com> wrote: > On Fri, 2009-06-19 at 09:14 +0300, Abdulaziz Ghuloum wrote: >> 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.), > > Oh yeah, I remember the discussion at larceny-users about that [1]. Odd > that it worked for Larceny but not PLT. (Implicit phasing needs to > win...) > >> so, maybe you have to do >> (import (for (prefix (rnrs) a.) (meta -1))) >> in the two auxiliary libraries. > > I just changed my t2.sps to do that and now PLT does work (i.e. the > predicate is broken) and Larceny still works too. > >> > 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 [...] >> >> or we can use the previous definition using generate-temporaries. > > I think the generate-temporaries way should be made to be portable > because identifiers which do not come from any lexical context should > not have any lexical context. What lexical context could they possibly > have which would make any sense? But it does seem hackish because > generate-temporaries wasn't intended for this. And likewise, using > free-identifier=? seems hackish because we're not actually interested in > comparing two identifiers. > >> But I'm still curious about a portable and pure R6RS solution. > > Me too. With all these aspects to balance, it's getting challenging :) > >> 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). > > That's an interesting conundrum. That's the most interesting example > I've seen of this issue. I'm still undecided about this issue. I'll > leave it to you experts to compete for the most convincingly better > way :) Once I'm convinced, I'm a volunteer mercenary :) > > [1] http://lists.ccs.neu.edu/pipermail/larceny-users/2009-April/000622.html > > -- > : Derick > ---------------------------------------------------------------- > >