[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: typep optimization for CLOS-classes
- To: <email@example.com>
- Subject: Re: typep optimization for CLOS-classes
- From: Bruno Haible <firstname.lastname@example.org>
- Date: Mon, 18 Aug 1997 15:42:18 +0200 (MET DST)
- >received: from halles.ilog.fr (halles.ilog.fr [172.16.1.96]) by ilog.ilog.fr (8.8.7/8.7.3) with ESMTP id PAA21616; Mon, 18 Aug 1997 15:42:21 +0200 (MET DST)
- In-reply-to: <199708141641.SAA12300@orion.plopp.de>
- References: <199708141641.SAA12300@orion.plopp.de>
Matthias Lindner <email@example.com> writes:
> Reading the result of the second compilation triggers an error!
> I think this problem occurs, as the compiler optimized the expression
> (typep a '<B>) to (clos::subclassp (clos:class-of a) (find-class '<B>)).
> This is correct - unfortunately the compilation of this expression
> causes the insertion of #.(FIND-CLASS '<B>) into the .fas-file
> *before* the definition of class <B>.
Yes, this is unfortunate in your case, but it enables faster type checking.
The compiler's optimization of (typep a '<B>) into
(clos::subclassp (clos:class-of a) (load-time-value (find-class '<B>)))
is allowed by paragraph 220.127.116.11.8. of the CLHS:
"All conforming programs must obey the following constraints...:
Classes defined by `defclass' in the compilation environment must
be defined at run time to have the same superclasses and same
> It's not a big problem as it can be fixed by moving the definition of
> class <B> before the definition of method ISA-B, but sometimes it is
> annoying to sort class definition like this.
Yes, that's what you have to do: make sure that all class definitions
that were present in the compilation environment are loaded into the
runtime environment before all other runtime code.