[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Some invariants

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.

 (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.