root/trunk/bknr/datastore/experimental/mop-bug.lisp

Revision 725, 2.8 kB (checked in by manuel, 4 years ago)

NOBUG Klasse die beim Debuggen notwendig war

  • Property svn:eol-style set to native
  • Property svn:keywords set to author date id revision
Line 
1 (eval-when (:compile-toplevel :load-toplevel :execute)
2   (or (find-package :sarace)
3       (defpackage :sarace (:use :cl :pcl))))
4 (in-package :sarace)
5
6 (defclass bug-metaclass (standard-class)
7   ())
8
9 (defmethod validate-superclass ((sub bug-metaclass) (super standard-class))
10   t)
11
12 (defclass bug-direct-slot-definition (standard-direct-slot-definition)
13   ())
14
15 (defclass bug-effective-slot-definition (standard-effective-slot-definition)
16   ())
17
18 (defmethod direct-slot-definition-class ((class bug-metaclass) &rest initargs)
19   (declare (ignore initargs))
20   'bug-direct-slot-definition)
21
22 (defmethod effective-slot-definition-class ((class bug-metaclass) &rest initargs)
23   (declare (ignore initargs))
24   'bug-effective-slot-definition)
25
26 #+nil
27 (defmethod initialize-instance :after ((class bug-metaclass) &rest initargs)
28   (declare (ignore initargs))
29   (format t "SLOTS: ~S~%" (class-slots class)))
30
31 #+nil
32 (defmethod reinitialize-instance :around ((class bug-metaclass) &rest initargs)
33   (declare (ignore initargs))
34   (let* ((old-slots (class-slots class))
35          (new-class (call-next-method))
36          (new-slots (class-slots new-class)))
37     (format t "OLD-slots: ~S new-slots ~S~%" old-slots new-slots)
38     new-class))
39
40 #+nil
41 (defmethod compute-slots ((class bug-metaclass))
42   (let ((normal-slots (call-next-method)))
43     (cons (make-instance 'bug-effective-slot-definition
44                          :name 'bug-slot
45                          :initform nil
46                          :class class
47                          :initfunction #'(lambda () nil))
48           normal-slots)))
49
50 (defmethod (setf slot-value-using-class) :before
51     (newvalue (class bug-metaclass) object slot)
52   (format t "BEFORE method for slot setting~%"))
53
54 (defmethod (setf slot-value-using-class) :around
55     (newvalue (class bug-metaclass) object slot)
56   (format t "before slot setting~%")
57   (let ((result (call-next-method)))
58     (format t "after slot setting~%")
59     result))
60
61 (defmacro with-traced-functions ((&rest functions) &body body)
62   `(unwind-protect (progn (trace ,@functions) ,@body)
63     (untrace ,@functions)))
64
65 ;;; BUG BUG with 2 classes, before and around
66   (defclass test ()
67     ((a :initarg :a :initform 0))
68     (:metaclass bug-metaclass))
69
70
71 (defclass nobug-class (standard-class)
72   ())
73
74 (defmethod validate-superclass ((sub nobug-class) (super standard-class))
75   t)
76
77 (defclass nobug-direct-slot-definition (standard-direct-slot-definition)
78   ())
79
80 (defclass nobug-effective-slot-definition (standard-effective-slot-definition)
81   ())
82
83 (defmethod direct-slot-definition-class ((class nobug-class) &rest initargs)
84   (declare (ignore initargs))
85   'nobug-direct-slot-definition)
86
87 (defmethod effective-slot-definition-class ((class nobug-class) &rest initargs)
88   (declare (ignore initargs))
89   'nobug-effective-slot-definition)
90
91 (defmethod (setf slot-value-using-class) :around (newval (class nobug-class) object slot)
92   (call-next-method))
93
94
95 (defclass test2 ()
96   ((b :initarg :a :initform 0))
97   (:metaclass nobug-class))
Note: See TracBrowser for help on using the browser.