[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Recent questions about CLOS
I've seen several questions recently about what in the Symbolics CLOS
implementation is portable and what is standard. Perhaps I can help with a
A convenient source for the CLOS standard is chapter 28 of Common Lisp the
Language: Second Edition. There are also one or two items in other chapters,
such as MAKE-LOAD-FORM. If you adhere to this standard, you have a good shot
at portability, although every implementation I've seen leaves out one or
another feature at present, and the features left out in different
implementations are not always the same. Thus you need to consult the
documentation for the implementations you plan to port to.
In Genera 8.0 and Cloe 3.0, the symbols exported by the CLOS package include
everything that's standard, plus a number of extensions to the standard.
These extensions are a subset of the metaobject protocol that was easy to
agree on. Generally they let you examine the state of metaobjects but don't
define how to change the state or make your own metaobjects. These extensions
are portable between Genera and Cloe of course, and are also portable, with a
small number of exceptions, to Lucid 4.0.0. I think they are portable to
Franz's forthcoming release as well, although I have not tested that myself
and I might be misremembering. Thus if you use these extensions your code is
not as portable as it would be if it kept strictly to the standard, but it's
not completely unportable either. It makes sense to call functions such as
CLOS:CLASS-SLOTS if they do something that you need.
In Genera and Cloe there is also a CLOS-INTERNALS package. If you use this
all bets are off as far as portability goes. It is not even compatible
between Genera and Cloe, or even between Ivory and 3600, in some cases.
Symbolics' documentation policy for CLOS is at present to document only the
things that are standard, not the extensions. This is to avoid the
possibility of having to change documented interfaces if later on a standard
is adopted that includes some or all of the extensions, but with variations
from what we and some of the other Lisp vendors have implemented.
Another source of information about CLOS is the metaobject protocol document
available from Xerox. This is an evolving document that is aimed at becoming
a standard someday, but at present does not match any implementation. Where
this document overlaps with the extensions exported by the CLOS package, they
were in agreement in most cases, the last time I looked.
The question of speed also came up. The speed of CLOS on Ivory-based machines
is about the same as the speed of Flavors on the same machine. I have
measured the speed of Franz and Lucid's CLOS implementations and found them
generally quite tolerable, with a SUN-4 (SPARCstation 1) delivering about the
same speed as an XL400. I don't think I'm allowed to tell you which of the
two vendors I found to be faster, but it's not important since they were
fairly close. The speed of CLOS in Cloe is also tolerable, comparable to a
3600 when running on a less than premium performance 386 PC. There are a
number of other CLOS implementations in existence and I haven't looked at
them, but in general I don't think you need to be afraid of slow
implementations when using CLOS. I'm sure there is room for improvement, but
I don't think the implementations now available are unusably slow.