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

keywords revisited



Nick,

  My idea of how all this ought to work is based on the idea that
any symbol accessible in the keyword package is in fact a keyword,
so that reading :FOOBAZ is always synonymous with

	(INTERN "FOOBAZ" keyword-package)

If we allow any symbol to be accessible via using other packages or
having a symbol imported into the keyword package without
"keywordizing" it, then we violate the accessibility issues I have
raised. If we define keywordize in the brutal fashion described in:

	(defun keywordize-symbol (symbol)
	   (let ((home (symbol-package symbol))
	         (key-package (find-package "KEYWORD")))
		(unless (eq home key-package)
		   (if home (unintern symbol home))
		   (setf (symbol-value symbol) symbol)
		   (import symbol key-package))))

then allowing other interned symbols into the keyword package
does not violate my accessibility requirement. I think bashing
an interned symbol's home package and its value is somewhat
drastic. I dont feel as bad bashing a gensym or the result
of make-symbol.

  To summarize, I think we should have done things this way:

(1) The keyword package is isolated, i.e. it never uses (or is used
    by) other packages.

(2) Any symbol accessible in the keyword package is a keyword, i.e.
    its home package is the keyword package and its value is itself.

(3) Symbols only become accessible in the keyword package via INTERN.

  It is unclear to me why anyone would want to import a symbol which
is homed someplace else into the keyword package. My only concern is
that any symbols accessible in the keyword package be keywords. I
really dont like the problems which come up with reading/printing
given that reading :KEYWORD should produce a keyword. If a symbol
is accessible in the keyword package but not homed in the keyword
package, then it wont print as a keyword making one more subtle case
of read/print inconsistency. I guess I could have the reader
do a bunch of tricky things like shadow :-) ....

--David

p.s. Apologies if this came twice. Mailers are out to the beach these
	 days.