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

Exact type



I have second thoughts about allowing any common lisp type
in (declare (exact-type ...))

- First, what does exact-type means?
Since type-of cannot be trusted to return the most specific type an
object is of, we have to base our definition on TYPEP.
I propose this one:

x is of exact-type X if it verifies:
Let Y be a type such as (SUBTYPEP X Y) is true, 
then (TYPEP x Y ) is false.

I think it does what JAK meant.

- Assuming that my definition is correct, for which type does it make
sense?
It makes sense for our classes since all the subclasses can be known,
they are user classes.
By the same token, it makes sense for defstruct types.
But allowing the other COMMON subtypes would makes programs non portable:
The list of subtypes of a type is implementation dependent. We say (page
1-14) that individual implementation can add additional subclass
relationships as long as they don't violate CLtL.

I propose that we restrict the types acceptable to (declare (exact-type
...)) to CLOS classes and structure types.

Patrick.