Test if a class is a subclass of another class in common lisp
Asked Answered
W

2

11

How do I see if one CLOS class is a subclass of another CLOS class?

Writhe answered 3/6, 2010 at 23:6 Comment(0)
S
11

You can get the CLASS-NAME of a class.

A class has also a type of the same name.

SUBTYPEP tests if a type is a subtype of another type.

Schauer answered 3/6, 2010 at 23:25 Comment(0)
R
3

closer-mop provides a subclassp predicate

CL-USER> (c2mop:subclassp (find-class 'condition) (find-class 'error))
NIL
CL-USER> (c2mop:subclassp  (find-class 'error) (find-class 'condition))
T
Rosaniline answered 17/2, 2016 at 17:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.