[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Name That Class
- To: RPG@SAIL.STANFORD.EDU
- Subject: Re: Name That Class
- From: Gregor.pa@Xerox.COM
- Date: 28 Jul 87 19:21 PDT
- Cc: common-lisp-object-system@SAIL.STANFORD.EDU
- In-reply-to: Dick Gabriel <RPG@SAIL.STANFORD.EDU>'s message of 27 Jul 87 11:59 PDT
It seems to me that there are ways for class-named and setf of such to
work. I think only two of these are reasonable, but I will include the
third for completeness. Note that this same analysis applies to
generic-function-name and setf of symbol-function and
get-setf-generic-function. I will do class names first.
A class C 'is bound to' a given name Ni iff (class-named Ni) returns C.
In all this solutions, we document class-named and setf of class-named.
We say that class-named returns the class is bound to a particular name.
We say that setf of class-named can be used to set the binding of a
class to a name.
Solution 1:
Only document class-named and setf of class-named. Most
implementations will have some magic for printing out a class's name
when it has one.
Solution 2:
Document class-named and setf of class-named. Also document
class-name, but say that the the class may or may not 'bound' to that
name.
Solution 3:
Document class-named and class-names and setf of class-named. Say
that setf of class-named can be used to bind a clas to a name. Say that
class-names returns the list of all names that a class is bound to. For
example:
(setq foo (make-instance 'standard-class))
#<Standard-Class NIL 1>
(setf (class-named 'n1) foo)
#<Standard-Class N1 1>
(setf (class-named 'n2) foo)
#<Standard-Class N2 1>
(class-names foo)
(N1 N2)
(setf (class-named 'n1) nil)
#<Standard-Class N2 1>
(setf (class-named 'n2) nil)
#<Standard-Class NIL 1>
(class-names foo)
()
It seems to me that solution 1 and solution 3 are the only reasonable
ones. My general dislike of names makes me prefer solution 1, but I
think that solution 3 actually provides users some important
functionality.
I think its easy to see how this whole thing would work for
generic-function-name, symbol-function, setf of symbol-function,
get-setf-generic-function and setf of get-setf-generic-function.