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

From: Alex Shinn (foof at synthcode.com)
Date: Sun Oct 2 20:23:21 EDT 2005

At Sun, 2 Oct 2005 00:51:46 -0400, Eli Barzilay wrote:
> On Oct  1, Alex Shinn wrote:
> > At Sat, 1 Oct 2005 09:53:04 -0400, Eli Barzilay wrote:
> > > 
> > > And in these discussions, prefix is said to have the advantage of
> > > being visually similar to a quote.
> > 
> > I would consider this a disadvantage, because the prefix quote has
> > nothing to do with quote - it's a new literal value.  It has very
> > different semantics from quoting.
> It is similar in being self-quoting.  But like I said -- this is a
> common point, go on cls (and cll) and try it out.

I've searched and can find no discussions (on either newsgroup or on
the web) of this issue.  I can find many general keyword debates, and
sometimes the "think of colon as a quote" argument turns up, but this
is in defense of keywords in general, not as opposed to suffixing.

The generally used term for what keywords do is "self-evaluating," not
"self-quoting."  Googling the two (plus "scheme") turns up an order of
magnitude more hits for the former, with the latter mostly refering to
a few Guile references and conspicuously this very thread at second

The term self-quoting seems a little confusing, as it suggests the
idea of a quote being inserted.  This is not the case.  The difference
can been seen in:

  (list 'a 'b 'c)  =>  (a b c)      ; quotes go away
  (list :a :b :c)  =>  (:a :b :c)   ; colons remain

Terminology and all other arguments aside, to suggest a prefix colon
is similar to quote is to invite confusion.  Keywords evalute to
themselves, like numbers and string literals.

> > Yes, the module system would have to check for this and convert the
> > keyword,
> That would be a hack.  I would prefer using
>   (require (prefix foo\: "foo.ss"))
> for such cases (imagine the mess that will happen with implementations
> that treat :foo and foo: as the same value).

That's an interesting point.  However, you can still have both the
automatic keyword conversion (to suffix) and still let users
explicitly write (require (prefix \:foo "foo.ss")) if they actually
want such an odd prefix.

> > but at least it wouldn't affect any user code [...]
> Huh?  I think that the damage to current code is roughly the same.

This is taken out of context - it's in reference to the specific issue
of prefix importing.  After a one-line change in the module system,
users will not have to change their code - with respect to the prefix
import it will just work.  This is as opposed to such things as
SRFI-42 and :optional where users will need to be aware of keywords
and work around them with \ or #-k.


Posted on the users mailing list.