> I've dealt with this by not using the literals list. Instead, use > fenders which check (underscore? #'pattern-variable)
This option is always available to macro writers... so whether auxiliary keywords are exported or whether they respond to rebinding or renaming has to be macro-dependent... The unfortunate thing is that you don't get fenders with syntax-rules. If using symbolic-identifier=? in fenders were used more widely (which I think would have to mean fenders were available in syntax-rules, or, even better, it was the default for the literals list), the issue of renaming macro-local keywords for translation or other purposes would probably become very focused on the cases where it is actually needed. I don't think match or cond or case are really examples where you need the keywords to be keywords rather than symbols. On Wed, May 27, 2009 at 11:16 PM, Derick Eddington <[email protected]> wrote: > On Wed, 2009-05-27 at 18:12 +1000, Ramana Kumar wrote: >> I remember one of the arguments for exporting auxiliary keywords was >> so that they could be renamed. This is usually demonstrated when you >> change "else" to be a translation in another language. I'm not sure >> how strong that argument is, > > Ah, that's an interesting aspect. We should search the R6RS discussion > archives about this. But still, exporting macro-local keywords doesn't > seem right. Instead of making translation wrapper libraries by just > renaming bindings, each macro with auxiliary keywords which need to be > translated could be proxied by a new macro which does the translation of > the auxiliary keywords. It would be non-trivial for some macros, but > might be better than the clutter and tedium of auxiliary keywords > everywhere just for this more remote need. But! such proxy macros are > not the same binding as what they're translating and so > (free-identifier=? cond 枝) would not work but it should because it can > matter for some situations. Macros could be made more abstracted to > find auxiliary keywords against extendable lists of translations, this > way, exporting auxiliary keywords would not be necessary and translation > collections would extend these lists and the bindings would just be > renamed and all stay the same, or something... sounds interesting to > explore... > >> but I have come across this in a real >> situation: the pmatch pattern matcher uses the underscore as a >> wildcard, but underscore is no longer a valid literal in R6RS. So I >> replace _ with ? in the pmatch library, then do (import (except (rnrs) >> _) (rename (pmatch) (? _))) in the script using pmatch so I can >> continue to use underscore. > > I've dealt with this by not using the literals list. Instead, use > fenders which check (underscore? #'pattern-variable) where underscore? > is defined as: > > (define (underscore? x) > (and (identifier? x) (free-identifier=? x #'_))) > > I used this when porting R5RS code which had _ in the literals lists. > See the (xitomatl AS-match) port of Alex Shinn's matcher. > > For my (xitomatl match), I use my identifier?/name=? from my > (xitomatl macro-utils) in fenders like (identifier?/name=? #'pat-var '_) > because it does symbolic comparison rather than free-identifier=?. > > -- > : Derick > ---------------------------------------------------------------- > >
