source: trunk/abcl/src/org/armedbear/lisp/mop.lisp @ 13958

Last change on this file since 13958 was 13958, checked in by rschlatte, 9 years ago

Implement compute-default-initargs

File size: 3.8 KB
Line 
1;;;; Does not currently include all the MOP, but it should.
2
3(in-package #:mop)
4
5;;; StandardGenericFunction.java defines FUNCALLABLE-INSTANCE-FUNCTION and
6;;; SET-FUNCALLABLE-INSTANCE-FUNCTION.
7;;;
8;;; TODO
9;;;
10;;;   1. Verify that we can make FUNCALLABLE-STANDARD-CLASS instances
11;;;      which work.
12;;;
13;;;   2. Tighten the type checks so that only instances of
14;;;      FUNCALLABLE-STANDARD-CLASS are callable.
15
16;;; AMOP pg. 240ff.
17(defgeneric validate-superclass (class superclass)
18 (:documentation 
19  "This generic function is called to determine whether the class
20  superclass is suitable for use as a superclass of class."))
21
22(defmethod validate-superclass ((class class) (superclass class))
23  (or (eql superclass +the-T-class+)
24      (eql (class-of class) (class-of superclass))
25      (or (and (eql (class-of class) +the-standard-class+)
26               (eql (class-of superclass) +the-funcallable-standard-class+))
27          (and (eql (class-of class) +the-funcallable-standard-class+)
28               (eql (class-of superclass) +the-standard-class+)))))
29
30;;; This is against the letter of the MOP, but very much in its spirit.
31(defmethod validate-superclass ((class class)
32                                (superclass forward-referenced-class))
33  t)
34
35(defmethod shared-initialize :before ((instance class)
36                                      slot-names
37                                      &key direct-superclasses
38                                      &allow-other-keys)
39  (declare (ignore slot-names))
40  (dolist (superclass direct-superclasses)
41    (assert (validate-superclass instance superclass) (instance superclass)
42            "Class ~S is not compatible with superclass ~S"
43            instance superclass)))
44
45(export '(;; classes
46          funcallable-standard-object
47          funcallable-standard-class
48          forward-referenced-class
49          direct-slot-definition-class
50          effective-slot-definition-class
51          standard-method
52          standard-accessor-method
53          standard-reader-method
54          standard-writer-method
55         
56          compute-effective-slot-definition
57          compute-class-precedence-list
58          compute-default-initargs
59          compute-effective-slot-definition
60          compute-slots
61          finalize-inheritance
62          validate-superclass
63
64          slot-value-using-class
65          slot-boundp-using-class
66          slot-makunbound-using-class
67
68          ensure-class
69          ensure-class-using-class
70          ensure-generic-function-using-class
71
72          class-default-initargs
73          class-direct-default-initargs
74          class-direct-slots
75          class-direct-subclasses
76          class-direct-superclasses
77          class-finalized-p
78          class-prototype
79
80          add-direct-subclass
81          remove-direct-subclass
82
83          generic-function-lambda-list
84          generic-function-argument-precedence-order
85          generic-function-method-class
86
87          method-function
88          method-generic-function
89          method-lambda-list
90          method-specializers
91          method-qualifiers
92
93          standard-reader-method
94          standard-writer-method
95          reader-method-class
96          writer-method-class
97
98          slot-definition
99          slot-definition-readers
100          slot-definition-writers
101          slot-definition-location
102          standard-instance-access
103          funcallable-standard-instance-access
104
105          intern-eql-specializer
106          eql-specializer-object
107          specializer-direct-methods
108          specializer-direct-generic-functions
109          add-direct-method
110          remove-direct-method
111
112          extract-lambda-list
113          extract-specializer-names
114
115          add-dependent
116          remove-dependent
117          map-dependents
118          update-dependent))
119
120(provide 'mop)
121
122
123
124
125
Note: See TracBrowser for help on using the repository browser.