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

Keywords in make-instance?



re:    Common Lisp does not specify that a keyword argument MUST come from the 
       keyword package.  They only do so by default.  The keyword arguments 
       for make-instance obey thi same rule.

	 danny

    This was my interpretation as well.  However, CLtL, does not
    explicitly say that the &key keyword can come from any package.  At
    least one vendor, (Lucid 2.04), restricts function lambda list &key
    keywords to being in the keyword package.


Danny is wrong here, as is your intuition too.  See the first sentence
on CLtL p62, which requires keyword parameter names to be "keywords" 
(i.e., symbols in the keyword package).  There is even a "rationale" 
proffered for this decision.  [This certainly is an easy one to overlook, 
since 1988 hindsight has so many advantages over 1983 foresight.]

Lucid obeys the letter-of-the-law from CLtL, but has given full support
to the X3J13 Cleanup Committee's proposal entitled
	KEYWORD-ARGUMENT-NAME-PACKAGE:ANY
which relaxes the CLtL constraint.  In fact, one of the motivating forces 
behind this proposal is so that CLOS methods aren't limited to having
&key arguments named only in the "flat" namespace of package KEYWORD.
[There is a reason why such a limitation is much more troublesome when
using defmethod than when using defun or defmacro, but I'll not take time
to go into it now.]

Lucid release 2.1 and later doesn't seem to impose the constraint in 
compiled functions; I don't know about release 2.04.  It is Lucid's intent 
to conform to the X3J13 proposal as soon as practical after its adoption.


-- JonL --