[plt-scheme] keywords (a backward-incompatible change)

From: Eli Barzilay (eli at barzilay.org)
Date: Sat Oct 1 10:21:03 EDT 2005

On Oct  1, Eli Barzilay wrote:
> SRFI-42 is the most problematic piece of code.  Ryan suggested that
> it is easy to solve using a #k- prefix for the code, and requiring
> it with a prefix in code that wants to use it without #k-.  (Minor
> ugliness: if you use a `foo:' prefix, you'll get some `foo::blah'
> identifiers there.)  In any case, identifiers that end with a colon
> are also valid in r5rs, so suffix just shifts the problem elsewhere.
> The majority of :foo uses in identifier names are ones that are
> *supposed* to behave like keywords, so the change is mostly trivial.
> SRFI-42 is a major exception.

I (partially) take this back.  It seems that in the SRFI-42
implementation, :foo syntaxes are ones that should only be used in a
comprehension macro -- the actual use of the :macro is changed so that
a continuation macro is planted in that use, this is in this clause of
`do-ec':

     (do-ec (g arg1 arg ...) cmd)
     ->
     (g (do-ec:do cmd) arg1 arg ...)

So it seems like it would be easy to insert one more step to this
chain:

     (do-ec (g arg1 arg ...) cmd)
     ->
     (unkeywordify g (do-ec:do cmd) arg1 arg ...)

and make `unkeywordify' a syntax-case macro that will do this
transformation:

     (unkeywordify :foo rest ...)  ; :foo is some keyword
     ->
     (\:foo rest ...)              ; using the identifier \:foo instead

I think that this may work fine.
-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.