Регистрация | Войти
Lisp — программируемый язык программирования
Better proxy-route mechanism
Автор: LinkFly - 2011-02-25T16:16:35.000000+03:00
(defclass route ()
  ((x :initarg :x)
   (y :initarg :y)
   (z :initarg :z)
)
)


(defclass proxy-route (route)
  ((route :initarg :route :accessor get-route :type route))
)


(defmethod initialize-instance :after ((proxy-route proxy-route) &key &allow-other-keys)
  (with-slots ((route-x x) (route-y y) (route-z z))
      (get-route proxy-route)
    (with-slots (x y z)
        proxy-route
      (setf x route-x
            y route-y
            z route-z
)
)
)
)


(setq route (make-instance 'route :x 1 :y 2 :z 3))
(with-slots (x y z) route (list x y z))
;;;!!!
(setq proxy-route (make-instance 'proxy-route :route route))
(with-slots (x y z) proxy-route (list x y z))
@2009-2013 lisper.ru