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 ----------------------------------------------------------------
