Re: Ensuring class x is a superclass of class y
"Michał "phoe" Herda (as phoe at disroot dot org)" <[email protected]>
| Newsgroups | gmane.lisp.lispworks.general |
|---|---|
| Message-ID | <[email protected]> |
http://metamodular.com/CLOS-MOP/compute-class-precedence-list.html says that you should be able to call COMPUTE-CLASS-PRECEDENCE-LIST yourself if the class is not http://metamodular.com/CLOS-MOP/class-finalized-p.html CLASS-FINALIZED-P. W dniu 2026-03-21 11:09, Tim Bradshaw (as tfb at tfeb dot org) napisał(a): > This is a general CL question (although it's MOPpy and I need the > answer to work in LW). > > I have a metaclass, soa-class, which has some additional behaviour from > standard-class. There is a class, soa, which is an soa-class, but > whose direct superclass is standard-object. soa needs to be a > superclass of any soa-class, except itself. > > What I currently do is have methods on validate-superclass which will > succeed if both classes are soa-classes, but will succeed if the > superclass is a standard-class and the subclass is an soa-class only if > the subclass is named soa. > > This achieves what I want, but it also does something much stronger: if > an soa-class has superclasses x, y, ... z then *all* of these must be > soa-classes. So I can't use mixin classes which are not themselves > soa-classes. That's stronger than I need or want. > > What is the appropriate way to ensure that, in the above case, at least > one of x, y ... z is an soa-class? Is the superclass argument to > validate-superclass finalized enough that I can check its precedence > list? > > --tim > > (Sigh. Every time I use the CLOS MOP I realise how lucky we are they > didn't try to standardise it as part of CL: the language never would > have been standardised if they had. It's just made of jelly, and > language standards made of jelly are not a good idea. Although they > can be nutritious.) > > _______________________________________________ > Lisp Hug - the mailing list for LispWorks users > [email protected] > http://www.lispworks.com/support/lisp-hug.html