From: Mike B. <be...@hi...> - 2003-10-30 05:40:19
|
All, I think there is a bug in ABL in not handling the accessors correctly. Generics do work correctly, however. The attached code does work in Clisp, Allegro and CMU but not in ABL, - Mike ;;--------------------------------- ;; define classes ;;--------------------------------- (defclass shape() ((color :initform 0.0 :initarg :start-color :accessor shape-color))) (defclass rectangle(shape) ((height :initform 0.0 :initarg :start-height :accessor rectangle-height) (width :initform 0.0 :initarg :start-width :accessor rectangle-width))) ;;--------------------------------- ;; define generics ;;--------------------------------- (defgeneric paint (shape)) (defgeneric compute (circle rectangle circle2)) ;;--------------------------------- ;; bind to shape ;;--------------------------------- (defmethod paint ((aShape shape)) (print (shape-color aShape))) ;;--------------------------------- ;; bind to rectangle ;;--------------------------------- (defmethod paint ((aShape rectangle)) (print (rectangle-height aShape))) ;;--------------------------------- ;; Create some object instances ;;--------------------------------- (setq r (make-instance 'rectangle :start-height 2.0 :start-width 4.0)) ;;--------------------------------- ;; set some values in the objects ;;--------------------------------- ;; BUG1: NOT WORKING IN AB!!!!! (setf (rectangle-height r) 10) (paint r) |