Commit f75fc391 authored by Pascal Costanza's avatar Pascal Costanza
Browse files

Changes triggered by Christophe Rhodes / SBCL.

darcs-hash:b4be9c6147a26c1e9767e9951f49aee2c898655b
parent daba12aa
......@@ -19,6 +19,7 @@
:clisp
:accessor-method-initialized-with-function (no)
:add-method-calls-compute-discriminating-function (no)
:compute-slots-requested-slot-order-honoured (no)
:defmethod-calls-make-method-lambda (no)
:forward-referenced-class-changed-by-change-class (no)
:initialize-instance-calls-compute-discriminating-function (no)
......@@ -37,6 +38,8 @@
:class-initialization-calls-reader-method-class (fixed)
:class-initialization-calls-writer-method-class (fixed)
:dependent-protocol-for-generic-functions (fixed)
:discriminating-functions-can-be-closures (no)
:discriminating-functions-can-be-funcalled (no)
:documentation-passed-to-effective-slot-definition-class (redef sc)
:effective-slot-definition-initialized-with-documentation (redef sc)
:method-initialized-with-function (no)
......@@ -139,6 +142,8 @@
:compute-applicable-methods-using-classes (no)
:defmethod-calls-generic-function-method-class (no)
:defmethod-calls-make-method-lambda (no)
:discriminating-functions-can-be-closures (no)
:discriminating-functions-can-be-funcalled (no)
:funcallable-standard-object (no)
:function-invocation-calls-compute-applicable-methods (no)
:function-invocation-calls-compute-applicable-methods-using-classes (no)
......@@ -154,6 +159,7 @@
:setf-generic-function-name (no)
:setf-generic-function-name-calls-reinitialize-instance (no)
-
:compute-slots-requested-slot-order-honoured (no)
:direct-slot-definition (fixed)
:direct-superclasses-by-default-empty (not fixed, but direct superclasses are automatically adjusted, not for funcallable-standard-class though)
:effective-slot-definition (fixed)
......@@ -168,6 +174,8 @@
:compute-applicable-methods-using-classes (no)
:defmethod-calls-generic-function-method-class (no)
:defmethod-calls-make-method-lambda (no)
:discriminating-functions-can-be-closures (no)
:discriminating-functions-can-be-funcalled (no)
:funcallable-standard-object (no)
:function-invocation-calls-compute-applicable-methods (no)
:function-invocation-calls-compute-applicable-methods-using-classes (no)
......@@ -181,6 +189,7 @@
:setf-generic-function-name (no)
:setf-generic-function-name-calls-reinitialize-instance (no)
-
:compute-slots-requested-slot-order-honoured (no)
:eql-specializer (fixed)
:sbcl
......@@ -194,9 +203,7 @@
:dependent-protocol-for-generic-functions (fixed)
:documentation-passed-to-effective-slot-definition-class (redef finalize-inheritance)
:effective-slot-definition-initialized-with-documentation (redef finalize-inheritance)
:metaobject (no)
:method-initialized-with-function (no)
:reinitialize-instance-calls-compute-discriminating-function (fixed)
:setf-class-name-calls-reinitialize-instance (no)
:setf-generic-function-name-calls-reinitialize-instance (no)
:standard-class-and-funcallable-standard-class-are-compatible (no)
......@@ -14,12 +14,13 @@ Allegro Common Lisp, 6.2 Trial edition and 7.0
- STANDARD-CLASS and FUNCALLABLE-STANDARD-CLASS are not compatible. Not fixed.
- VALIDATE-SUPERCLASS doesn't recognize T as a valid superclass. Not fixed.
CLisp, 2.34, 2.35
CLisp, 2.35
None of the incompatibilities in CLisp are fixed.
- Methods are not initialized with :function.
- ADD-METHOD, REMOVE-METHOD, INITIALIZE-INSTANCE and REINITIALIZE-INSTANCE do not determine a new discriminating function. This is postponed until function invocation instead, so shouldn't be a problem in practice.
- The slot order requested by a primary method for COMPUTE-SLOTS is not honoured by this MOP.
- DEFMETHOD does not call MAKE-METHOD-LAMBDA.
- A FORWARD-REFERENCED-CLASS is not changed via CHANGE-CLASS (but is correctly reinitialized via REINITIALIZE-INSTANCE).
- MAKE-METHOD-LAMBDA is not provided.
......@@ -30,6 +31,7 @@ CMUCL 19b
- Accessor methods are not initialized with :function, :lambda-list, :slot-definition and :specializers. Fixed.
- Classes cannot be anonymous. Fixed.
- Class initialization doesn't call READER-METHOD-CLASS and WRITER-METHOD-CLASS for accessor methods. Fixed.
- The object returned by compute-discriminating-function cannot be a closure. Likewise, the second parameter to set-funcallable-instance-function cannot be a closure, but only a "pure" function/thunk. Not fixed.
- The dependent protocol for generic functions doesn't work fully. Fixed.
- Effective slot definitions are not initialized with :documentation, and EFFECTIVE-SLOT-DEFINITION-CLASS also doesn't receive that initarg. Not fixed.
- Methods are not initialized with :function. Not fixed.
......@@ -99,6 +101,8 @@ MCL 5.1
In MCL, generic functions work completely differently than specified. The specific incompatibilities are not listed and are not fixed.
- The object returned by compute-discriminating-function cannot be a closure. Likewise, the second parameter to set-funcallable-instance-function cannot be a closure, but only a "pure" function/thunk. Not fixed.
- The slot order requested by a primary method for COMPUTE-SLOTS is not honoured by this MOP. Not fixed.
- DIRECT-SLOT-DEFINITION, EFFECTIVE-SLOT-DEFINITION, EQL-SPECIALIZER, SLOT-DEFINITION and STANDARD-SLOT-DEFINITION are not exported. Fixed.
- When classes are initialized, :direct-superclasses are by default not empty. Not fixed, but direct superclasses are automatically adjusted when you use the standard idiom for adding a new default superclass.
- Multiple slot options are not passed as lists to DIRECT-SLOT-DEFINITION-CLASS. Not fixed, but use FIX-SLOT-INITARGS as a workaround.
......@@ -108,25 +112,27 @@ OpenMCL, 0.14.3
In OpenMCL, generic functions work completely differently than specified. The specific incompatibilities are not listed and are not fixed.
- The object returned by compute-discriminating-function cannot be a closure. Likewise, the second parameter to set-funcallable-instance-function cannot be a closure, but only a "pure" function/thunk. Not fixed.
- The slot order requested by a primary method for COMPUTE-SLOTS is not honoured by this MOP. Not fixed.
- EQL-SPECIALIZER is not exported. Fixed.
SBCL, 0.9.3, 0.9.4
SBCL, 0.9.6
- Accessor methods are not initialized with :function, :lambda-list, :slot-definition and :specializers. Fixed.
- Classes cannot be anonymous. Fixed.
- Class initialization doesn't call READER-METHOD-CLASS and WRITER-METHOD-CLASS for accessor methods. Fixed.
- The dependent protocol for generic functions doesn't work fully. Fixed.
- Effective slot definitions are not initialized with :documentation, and EFFECTIVE-SLOT-DEFINITION-CLASS also doesn't receive that initarg. Not fixed.
- METAOBJECT doesn't exist. Not fixed.
- Methods are not initialized with :function. Not fixed.
- REINITIALIZE-INSTANCE doesn't determine a new discriminating function. Fixed.
- (SETF CLASS-NAME) and (SETF GENERIC-FUNCTION-NAME) do not use REINITIALIZE-INSTANCE for changing the names. Not fixed.
- STANDARD-CLASS and FUNCALLABLE-STANDARD-CLASS are not compatible. Not fixed.
Summary:
- If you specialize COMPUTE-DEFAULT-INITAGS, conditionalize for the extra parameters in Allegro Common Lisp.
- In CMUCL, MCL and OpenMCL, the object returned by compute-discriminating-function cannot be a closure. Likewise, the second parameter to set-funcallable-instance-function cannot be a closure, but only a "pure" function/thunk.
- In CLisp, MCL and OpenMCL, the slot order requested by a primary method for COMPUTE-SLOTS is not honoured by the respective MOPs.
- Don't rely on FIND-METHOD-COMBINATION to do its job correctly, only when you don't provide method combination options.
- MAKE-METHOD-LAMBDA only works in CMUCL and SBCL as specified (but make sure that the respective generic function and method metaobject classes and make-method-lambda definitions are part of your compilation enviroment). MAKE-METHOD-LAMBDA also works in LispWorks, but the returned lambda expressions don't adhere to the AMOP specification (which may be good enough for your purposes).
- Specialize the methods for the dependent protocol on the class or generic function metaobject class. The example in AMOP doesn't do this but that is fragile code.
......@@ -134,7 +140,7 @@ Summary:
- CLisp doesn't change a FORWARD-REFERENCED-CLASS via CHANGE-CLASS. Apart from that, FORWARD-REFERENCED-CLASS works reliably across all MOPs.
- Effective slot definitions and EFFECTIVE-SLOT-DEFINITION-CLASS don't receive :documentation in CMUCL and SBCL, and no :allocation (!) in LispWorks.
- If you specialize DIRECT-SLOT-DEFINITION-CLASS, use FIX-SLOT-INITARGS in portable code.
- In CMUCL, SBCL and LispWorks, STANDARD-CLASS and FUNCALLABLE-STANDARD-CLASS are not compatible.
- In Allegro, CMUCL and LispWorks, STANDARD-CLASS and FUNCALLABLE-STANDARD-CLASS are not compatible.
- The function invocation protocol only works in CMUCL, SBCL and CLisp.
- If you need to see :direct-default-initargs when classes are initialized, conditionalize on #+lispworks to receive :default-initargs instead.
- COMPUTE-DEFAULT-INITARGS doesn't exist (and isn't called) in LispWorks.
......@@ -143,5 +149,4 @@ Summary:
- If you need to see :declarations when generic functions are initialized, conditionalize on #+lispworks to receive 'declare instead. (Actually, AMOP and ANSI Common Lisp diverge in this regard. AMOP specifies that :declarations is used whereas ANSI Common Lisp specifies that 'declare is used. Since most MOP implementations adhere to AMOP in this regard, I have also chosen that path.)
- In Allegro Common Lisp and LispWorks, method functions take the original parameters that a generic function has received.
- In LispWorks, the class SPECIALIZER doesn't exist.
- In SBCL, the class METAOBJECT doesn't exist.
- If you need to rely on the generic function protocols, don't use MCL or OpenMCL (or be very careful - some minor things work there as specified).
......@@ -4,8 +4,8 @@
(:use #:common-lisp #:lispworks)
(:nicknames #:c2mop)
(:shadow #:defclass #:standard-class #:typep #:subtypep)
(:export #:defclass #:standard-class #:typep #:subtypep)
(:shadow #:typep #:subtypep)
(:export #:typep #:subtypep)
(:import-from
#+cmu #:clos-mop
......@@ -17,7 +17,7 @@
#:forward-referenced-class
#:funcallable-standard-class
#:funcallable-standard-object
#-sbcl #:metaobject
#:metaobject
#:slot-definition
#:specializer
#:standard-accessor-method
......@@ -103,7 +103,7 @@
#:forward-referenced-class
#:funcallable-standard-class
#:funcallable-standard-object
#-sbcl #:metaobject
#:metaobject
#:slot-definition
#:specializer
#:standard-accessor-method
......
(in-package :closer-mop)
;; The following is commented out. SBCL now supports compatible standard-class and
;; funcallable-standard-class metaclasses, but this requires that we don't mess with
;; the class hierarchy anymore. So we will try the trick we have already used
;; for generic functions: We just add methods for the existing metaclasses.
;; This is not AMOP-compliant, but if it works it works.
#|
;; We need a new standard-class for various things.
(cl:defclass standard-class (cl:standard-class)
......@@ -21,11 +28,19 @@
(or (when (eq (class-of class) (find-class 'standard-class))
(member (class-of superclass)
(list (find-class 'cl:standard-class)
(find-class 'standard-class))))
(find-class 'standard-class)
#+sbcl (find-class 'funcallable-standard-class))))
(call-next-method)
(when (eq (class-of superclass) (find-class 'cl:standard-class))
(validate-superclass class (class-prototype (find-class 'standard-class))))))
#+sbcl
(cl:defmethod validate-superclass
((class funcallable-standard-class)
(superclass standard-class))
(and (eq (class-of class) (find-class 'funcallable-standard-class))
(eq (class-of superclass) (find-class 'standard-class))))
;; The following macro ensures that the new standard-class is used
;; by default. It would have been useful to fix other deficiencies
;; in a complete redefinition of defclass, but there is no portable
......@@ -38,9 +53,10 @@
`(cl:defclass ,name ,supers ,@options)
`(cl:defclass ,name ,supers ,@options
(:metaclass standard-class))))
|#
;; In CMUCL and SBCL, reader-method-class and writer-method-class are
;; not used during class initialization. The following three definitions
;; not used during class initialization. The following definitions
;; correct this.
(defun modify-accessors (class)
......@@ -70,7 +86,7 @@
unless (eq method-class (class-of writer-method))
do (add-method writer-function (apply #'make-instance method-class initargs)))))
;; The following two methods additionally create a gensym for the class name
;; The following methods additionally create a gensym for the class name
;; unless a name is explicitly provided. AMOP requires classes to be
;; potentially anonymous.
......@@ -81,10 +97,21 @@
(prog1 (apply #'call-next-method class :name name initargs)
(modify-accessors class)))
(cl:defmethod initialize-instance :around
((class funcallable-standard-class) &rest initargs
&key (name (gensym)))
(declare (dynamic-extent initargs))
(prog1 (apply #'call-next-method class :name name initargs)
(modify-accessors class)))
(cl:defmethod reinitialize-instance :after
((class standard-class) &key)
(modify-accessors class))
(cl:defmethod reinitialize-instance :after
((class funcallable-standard-class) &key)
(modify-accessors class))
;;; The following three methods ensure that the dependent protocol
;;; for generic function works.
......
......@@ -21,3 +21,7 @@ v0.2
- MCL also doesn't like anonymous classes. So I have added a fix for that.
- I have incorrectly reported that MAKE-METHOD-LAMBDA is unreliable in CMU CL and SBCL. This was due to a bug in my test suite. However, it is required that the respective generic function and method metaobject classes and make-method-lambda definitions are part of the compilation environment when you want to use them. I have updated the respective sections in features.lisp and features.txt.
- Switched to an MIT/BSD-style license.
v0.3
- Now supports SBCL 0.9.6.
- STANDARD-CLASS and FUNCALLABLE-STANDARD-CLASS are now compatible in SBCL. This required some changes in the PCL support.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment