The ability for a class to be redefined is a choice for a class author
to make. By default, classes in GOOPS are not redefinable. A
redefinable class is an instance of <redefinable-class>
; that is
to say, a class with <redefinable-class>
as its metaclass.
Accordingly, to define a redefinable class, add #:metaclass
<redefinable-class>
to its class definition:
(define-class <foo> () #:metaclass <redefinable-class>)
Note that any subclass of <foo>
is also redefinable, without the
need to explicitly pass the #:metaclass
argument, so you only
need to specify #:metaclass
for the roots of your application’s
class hierarchy.
(define-class <bar> (<foo>)) (class-of <bar>) ⇒ <redefinable-class>
Note that prior to Guile 3.0, all GOOPS classes were redefinable in
theory. In practice, attempting to, for example, redefine
<class>
itself would almost certainly not do what you want.
Still, redefinition is an interesting capability when building
long-lived resilient systems, so GOOPS does offer this facility.