Tobias Brandt <[email protected]>: > Couldn't just define <square> like this: > > (define-class <square> (<rectangle>)) > > then define a side method: > > (define-method (side (@ <square>)) (slot-ref @ 'height)) > > This way, you're not storing the same information twice.
Well, I was trying to find a simple toy example to demonstrate the need, but maybe I'll need to find a more compelling one. How about: ======================================================================== (define-class <error> () (msg #:getter msg #:init-keyword #:msg)) (define-class <file-error> (<error>) (path #:getter path #:init-keyword #:path) (code #:getter code #:init-keyword #:code) (fs #:getter fs #:init-keyword #:fs)) (define-method (initialize (@ <file-error>) args) (let-keywords args #f ((path #f) (code #f) (fs #f)) (next-method @ (list #:msg (format #f "File error in ~S (~S)" path code))))) ======================================================================== How do I now write the getters for path, code and fs? Marko
