[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Keywords in make-instance?
- To: Rob Pettengill <rcp@SW.MCC.COM>
- Subject: Re: Keywords in make-instance?
- From: Warren Harris <harris%hplwhh@hplabs.HP.COM>
- Date: Fri, 03 Jun 88 10:43:46 PDT
- Cc: commonloops.pa@Xerox.COM
- In-reply-to: Your message of Thu, 02 Jun 88 16:59:48 -0500. <8806022159.AA20155@perseus.sw.mcc.com>
- Redistributed: commonloops.pa
I think many lisp implementations (like Lucid and HP-CL) restrict &key
arguments to be in the keyword package is because it becomes tedious to
(xe:make-instance 'xe:window 'xe:width 30 'xe:height 20 ...)
when the current package is not importing the symbols used in the command.
The problem with this of course is that if the set of legal keywords is
unioned (as it is in multiple inheritance systems) there is a chance of
accidently shadowing some of the inherited parent's keywords if the parents
exist in different packages and have different semantics for the same
keyword name. For this reason, CLOS allows its init-keys to be in other
packages besides the keyword package.
The problem with the tediousness of explicitly typing the package name for
each &key argument could be circumvented if CL were to adopt the Zetalisp
convention of allowing the package prefix to prefix a form, rather than a
symbol. The symbols contained within the form would be read with a default
package corresponding to the prefix. The above expression would become:
xe:(make-instance 'window 'width 30 'height 20 ...)
which is just as easy to type as:
(make-instance 'xe:window :width 30 :height 20 ...)
but without the shadowing problems.
I think this syntax allows the best of both worlds. Does anyone know if
there is much chance of this convention being adopted by ANSI?