[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Comments on 87-002, Chapter 1
- To: Jim Kempf <kempf%hplabsc@hplabs.HP.COM>
- Subject: Comments on 87-002, Chapter 1
- From: David A. Moon <Moon@STONY-BROOK.SCRC.Symbolics.COM>
- Date: Wed, 11 Mar 87 21:15 EST
- Cc: common-lisp-object-system@sail.stanford.edu
- In-reply-to: <8702231935.AA19678@hplabsc>
Date: Mon, 23 Feb 87 11:35:56 pst
From: Jim Kempf <kempf%hplabsc@hplabs.HP.COM>
C) INTERACTION BETWEEN CLOS AND CL `DECLARE' AND `THE'
There is no mention in the document of how the CLOS will interact
with CL DECLARE and THE. The requirement that parameter specifiers
be type specifiers (pg. 1-19, paragraph 6) means that TYPEP
must do the right thing when given an instance object and
a valid class name (and presumably TYPEOF must return the class
name as well?) but does that mean I can say:
(DECLARE (TYPE TEXT-BUFFER X))
and:
(THE TEXT-BUFFER X)
I think that was the intention. We should say it explicitly so there
is no possibility of misinterpretation.
CLtL is vague on what happens if I try to bind X to something
not of TYPE TEXT-BUFFER and I have it so DECLAREd (see pg. 158)
but more explicit for THE (pg. 161). And what happens if
I have two TEXT-BUFFER classes, one whose metaclass is
the default and one with metaclass COMMON-OBJECTS-CLASS?
There can only be one class with a given name.
Seems to me an additional set of declarations are needed,
one, perhaps, restricting the metaclass
Could this be done by making all classes in that metaclass
(all instances of that metaclass) have a particular class as
a superclass? For instance, it has been proposed from time
to time that every standard class should have as a superclass
a class called STANDARD-OBJECT. Thus (THE STANDARD-OBJECT x)
would declare that x is an object with STANDARD-CLASS, or a
subclass of STANDARD-CLASS, as its metaclass.
and one for
specifying that a variable name can be bound to an
object of a particular class *or a subclass*, since
the restriction to a single class is covered by TYPE.
I think you're mistaken here. (THE INTEGER x) does not
imply that x is not a FIXNUM, and similarly (THE C x) does
not imply that (CLASS-OF x) is not a subclass of C. I don't
think Common Lisp has any way to declare that an object is of
a given type, and no more-specific type.
This would allow implementations to optimize method lookup
away at compile time to varying degrees, potentially
completely for a TYPE declaration, and partially
for subclass and metaclass declarations.
So far the standard proposal hasn't examined the issues involved in
early binding of classes and compiling-away of these types of decisions.
I think we should be completely open to a proposal here. I don't
think that a late-bound implementation is going to be so slow as to
demand this type of optimization to get anything done, but of course
the amount of speedup available depends on the machine.