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

subtypep



   From: janson@ATHENA.MIT.EDU

   i am using franz-allegro common lisp: "3.1.beta.28 [DEC 3100] (8/3;8/7/89)"
   the version of PCL is as supplied by them.

   i have been attempting to use subtypep to determine whether two classes are
   related, but it has not performed as i had expected it to.

   under "Integrating Types and Classes" in the 88-002R document it says:
   that (subtypep <class1> <class2>) will return t t if either <class1> is a
   subclass of <class2> or they are the same class. shouldnt this mean that
   under the following circumstances subtypep should by returning t ?

PCL is not CLOS, and "portable" PCL has no way to make class objects
be recognized as types by the Common Lisp type system.  The SUBTYPEP
in Allegro does not yet understand classes as types.  You will note
that SUBTYPEP returns NIL even if its arguments aren't known or valid
types.  (Perhaps it would be better for SUBTYPEP to signal error for
unknown types.  It certainly "is an error" but there is no requirement
that the error be signalled.)

   i did locate an un-exported function subclassp which does what i would like.
   should i come to depend on it?

I would assume this has been provided in PCL as a stopgap until
implementations have integrated implementations of CLOS.  It seems
reasonable for you to use it on this basis, with the understanding
that someday you will probably have to do a little bit of code editing
some time in the future.  If you intend your code to last a long time,
document this dependency.  The double colons in your code will serve
as an additional reminder, of course.

[By the way, I'm not sure whether PCL::SUBCLASSP will do the right
thing if the superclasses of a class are not yet all defined.  I don't
know that it will fail, but I don't know that it will work, either.
If this is important to your application, check it out...]