1 | ;;+----------------------------------------------------------------------------- |
---|
2 | ;;+ Isidorus |
---|
3 | ;;+ (c) 2008-2010 Marc Kuester, Christoph Ludwig, Lukas Georgieff |
---|
4 | ;;+ |
---|
5 | ;;+ Isidorus is freely distributable under the LLGPL license. |
---|
6 | ;;+ You can find a detailed description in trunk/docs/LLGPL-LICENSE.txt and |
---|
7 | ;;+ trunk/docs/LGPL-LICENSE.txt. |
---|
8 | ;;+----------------------------------------------------------------------------- |
---|
9 | |
---|
10 | |
---|
11 | (defclass Class-1 () |
---|
12 | ((value :initarg :value |
---|
13 | :accessor value))) |
---|
14 | |
---|
15 | (defmethod set-value :before ((inst Class-1) value) |
---|
16 | (format t ":before -> value is of type ~a~%" (type-of value))) |
---|
17 | |
---|
18 | (defmethod set-value ((inst Class-1) value) |
---|
19 | (format t ": -> value is being set to ~a~%" value) |
---|
20 | (setf (slot-value inst 'value) value)) |
---|
21 | |
---|
22 | (defmethod set-value :after ((inst Class-1) value) |
---|
23 | (format t ":after -> value was set to ~a~%" value)) |
---|
24 | |
---|
25 | (defmethod set-value :around ((inst Class-1) value) |
---|
26 | (format t ":around -> ???~%") |
---|
27 | (call-next-method inst "123")) ;calls the :before method with the |
---|
28 | ;arguments inst and "123" |
---|
29 | ;if no arguments are passed the arguments |
---|
30 | ;of the :around method are passed |
---|
31 | |
---|
32 | (defvar *inst* (make-instance 'Class-1)) |
---|
33 | (set-value *inst* "val") |
---|
34 | ;:around -> ??? |
---|
35 | ;:before -> value is of type (SIMPLE-ARRAY CHARACTER (3)) |
---|
36 | ;: -> value is being set to 123 |
---|
37 | ;:after -> value was set to 123 |
---|
38 | |
---|
39 | |
---|
40 | (defclass Class-2 (Class-1) |
---|
41 | ()) |
---|
42 | |
---|
43 | (defmethod set-value ((inst Class-2) value) |
---|
44 | (call-next-method) ;calls set-value of Class-1 |
---|
45 | (format t "(Class-2): -> value is being set to ~a~%" value) |
---|
46 | (setf (slot-value inst 'value) value)) |
---|
47 | |
---|
48 | (defvar *inst2* (make-instance 'Class-2)) |
---|
49 | (set-value *inst2* "val2") |
---|
50 | ;:around -> ??? |
---|
51 | ;:before -> value is of type (SIMPLE-ARRAY CHARACTER (3)) |
---|
52 | ;: -> value is being set to 123 |
---|
53 | ;(Class-2): -> value is being set to 123 |
---|
54 | ;:after -> value was set to 123 |
---|