Re: Ensuring class x is a superclass of class y

"Tim Bradshaw (as tfb at cley dot com)" <[email protected]>
Newsgroups gmane.lisp.lispworks.general
Message-ID <[email protected]>
To answer my own question, in case anyone else wants to be able to do this.

An approach which I think is safe and reliable is to define an around method on compute-class-precedence-list which calls the next method and then does the check.

In my case it also has to check that the class I want to be in the CPL has a name yet, because it may not do if compute-class-precedence-list is called during the definition of that initial class.  It seems to have a name for LW, but it doesn't for SBCL.  So if there is not yet a class with that name, you just assume it's OK, as the class whose CPL is being computed will be that class.

If an implementation doesn't memoize CPLs then this might be expensive, but they all do.

--tim

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
[email protected]
http://www.lispworks.com/support/lisp-hug.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.