[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Category Errors
- To: Common-lisp-object-system@SAIL.STANFORD.EDU
- Subject: Category Errors
- From: Dick Gabriel <RPG@SAIL.STANFORD.EDU>
- Date: 24 Jul 87 1136 PDT
Moon writes:
``I don't think this is fundamentally different from someone defining a
method on spaceships for a generic function that is only supposed to be
used with windows.''
Danny replies:
``I think this is exactly right.''
As I mentioned in my note, I don't care that this blemish appears in CLOS,
but I do insist that we understand that reasonable people will consider it
to be a blemish. The reason for this is also the reason that Danny's reply
is incorrect. The differences between someone writing a method on
spaceships for a generic function that is only supposed to be used with
windows and someone writing a method on a base-level class for the generic
function MAKE-INSTANCE are these:
1. MAKE-INSTANCE is a generic function defined in CLOS, and we
have the ability to enforce the user not making this sort of
error. We've carefully laid out, in most cases, the range of
legal arguments to functions and generic functions in CLOS; we
could easily do that here, whereas it's difficult to control a
user who wants to act irrationally with code all of his own
invention.
2. Mistakenly writing methods for some class not intended to be
the subject of the generic function by the author of that
generic function is most likely a user-level semantic error,
while defining a method on a class where the person defining
the generic function intends methods to be on meta-classes is a
category error - that's why I called it a ``category error''
rather than a ``source of potential user bugs.'' The error lies
in confusing two levels of classes defined in CLOS rather than
in confusing two classes defined by a user.
My point was that one could rationally design CLOS to be able to
distinguish between classes and meta-classes, and hence we would be
justified in trying to prevent category errors. Or we could choose not to
do that. I think that to dismiss the point as some fluke in thought
process before understanding the issues does ill justice to the
specification process, even though I believe we will allow the blemish.
-rpg-