[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Some invariants
- To: Danny Bobrow <Bobrow.pa@XEROX.COM>
- Subject: Re: Some invariants
- From: Dussud%Jenner%ti-csl.csnet@RELAY.CS.NET
- Date: 6-Jan-87 07:51:45
- Cc: Common-Lisp-Object-System@SU-AI.ARPA, Bobrow.pa@XEROX.COM
Here are some possible invariants and some arguments against them.
Which ones do you like?
(class-of (make-instance x)) = x
The class of the result of a make-instance is always the same as its
argument. A make-instance message could make a more specialized version
of itself, say as an environmental feature.
(not (eq (make-instance x) (make-instance x)))
This could usefully not be true if one of the initialization parameters
was a unique identifier (UID) that was supposed to identify the object
being created, and it already existed. Then the result of make-instance
should be the already existing object.
The arguments you give against those invariants make me think they would be true
only for the default class metaclass. Thus they shouldn't be stressed too much.
(eq (class-name (class-named x)) x)
This seems like it should be true, unless we make it such that classes
do not know their names, and the same class can have more than one name.
Is this useful? We could of course have a "hint" of a name in the class
for debugging purposes. This would make classes be first class
anonymous things as well.
I don't remember seeing CLASS-NAMED anywhere in the document, I might be wrong though.
Patrick.