This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: goops: slot option inheritance question


sen_ml@eccosys.com writes:

> is there anyway to get slot options to be inherited?  i'd like to
> specify some slot options in parent classes and then override and/or
> add slot options in inherited classes.

I'd like slot options to be inherited, but we need to think carefully
how this should be achieved.  We should probably do something similar
to what is done in the CLOS MOP.

Until then, you could let the `initialize' method parse your initargs
for options:

(define-class <being> ()
  (str)
  ...)

(define-method (initialize (being <being>) initargs)
  (let ((str-val (get-keyword #:str initargs #f)))
    (if str-val
        (set! (str being) str-val))))

(define-class <human> (<being>)
  (str #:accessor str #:init-value 12)
  (mag #:init-value 12)
  (dex #:init-value 12)
  (vit #:init-value 12))

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]