rationale? Taylor R. Campbell (11 Apr 2006 19:23 UTC)
Re: rationale? Per Bothner (11 Apr 2006 20:11 UTC)
Re: rationale? Marc Feeley (11 Apr 2006 20:30 UTC)

Re: rationale? Per Bothner 11 Apr 2006 20:11 UTC

Taylor R. Campbell wrote:
> I'm missing one part of the rationale:  Why do we need a separate data
> type?  Even in Common Lisp, keywords are symbols.

Common Lisp does have compound symbols, where a symbol comprises a
package and a package-local name.  But while the CL keyword ":foo"
is a symbol, it is different from the symbol "foo" because it is
in a different package.

A plausible solution is to introduce two-level names, as in CL.
That has a number of uses.  For example they could model XML's
two-level names.  However, I wouldn't want Common Lisp's rather
complex package semantics.  The problem is CL uses packages for
module visibility/import/export in an awkward way.

What we need are two predicates:
1: (general-symbol? x)
2: (simple-symbol? x) - which is true iff (general-symbol? x) and
    x is in the default unnamed package.
Standard R5RS symbols satisfy simple-symbol?.  Keywords, and the
special forms like #!optional satisfy general-symbol? but not
simple-symbol?.

The "legacy predicate" symbol? should be equivalent to one of
general-symbol? or simple-symbol? but I'm not sure which.  A
factor is an implementation may want to provide keywords without
full two-level symbols.
--
	--Per Bothner
xxxxxx@bothner.com   http://per.bothner.com/