[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rationale?



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
per@bothner.com   http://per.bothner.com/