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

From: Eli Barzilay (eli at barzilay.org)
Date: Sat Oct 1 09:53:04 EDT 2005

On Oct  1, Alex Shinn wrote:
> Have you considered colon-suffixed keywords?  Last I checked Scheme
> implementations were fairly evenly divided between prefix and
> suffix.
> 
> Suffix has the advantage that it better visually pairs the keyword
> with the value it labels.

And in these discussions, prefix is said to have the advantage of
being visually similar to a quote.  (BTW, if it wasn't clear from
Matthew's message, the actual use of keywords for arguments is an
orthogonal issue that will be left for a library (or libraries), there
is no requirement for using them only for keyword-value pairs...)
(BTW#2, it seems that prefix is a little more popular.)


> It also avoids conflicts with existing identifiers that begin with a
> colon, including almost all of SRFI-42.

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.

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.