:initial-element +slot-unbound+))))
instance))
-(defmacro allocate-funcallable-instance-slots (wrapper &optional
- slots-init-p slots-init)
+(defmacro allocate-standard-funcallable-instance-slots
+ (wrapper &optional slots-init-p slots-init)
`(let ((no-of-slots (wrapper-no-of-instance-slots ,wrapper)))
- ,(if slots-init-p
- `(if ,slots-init-p
- (make-array no-of-slots :initial-contents ,slots-init)
- (make-array no-of-slots :initial-element +slot-unbound+))
- `(make-array no-of-slots :initial-element +slot-unbound+))))
-
-(defun allocate-funcallable-instance (wrapper &optional
- (slots-init nil slots-init-p))
- (let ((fin (%make-pcl-funcallable-instance nil nil
- (get-instance-hash-code))))
+ ,(if slots-init-p
+ `(if ,slots-init-p
+ (make-array no-of-slots :initial-contents ,slots-init)
+ (make-array no-of-slots :initial-element +slot-unbound+))
+ `(make-array no-of-slots :initial-element +slot-unbound+))))
+
+(define-condition unset-funcallable-instance-function
+ (reference-condition simple-error)
+ ()
+ (:default-initargs
+ :references (list '(:amop :generic-function allocate-instance)
+ '(:amop :function set-funcallable-instance-function))))
+
+(defun allocate-standard-funcallable-instance
+ (wrapper &optional (slots-init nil slots-init-p))
+ (let ((fin (%make-standard-funcallable-instance
+ nil nil (get-instance-hash-code))))
(set-funcallable-instance-function
fin
#'(lambda (&rest args)
(declare (ignore args))
- (error "The function of the funcallable-instance ~S has not been set."
- fin)))
+ (error 'unset-funcallable-instance-function
+ :format-control "~@<The function of funcallable instance ~
+ ~S has not been set.~@:>"
+ :format-arguments (list fin))))
(setf (fsc-instance-wrapper fin) wrapper
- (fsc-instance-slots fin) (allocate-funcallable-instance-slots
- wrapper slots-init-p slots-init))
+ (fsc-instance-slots fin)
+ (allocate-standard-funcallable-instance-slots
+ wrapper slots-init-p slots-init))
fin))
(defun allocate-structure-instance (wrapper &optional
()))
(setq proto (if (eq meta 'funcallable-standard-class)
- (allocate-funcallable-instance wrapper)
+ (allocate-standard-funcallable-instance wrapper)
(allocate-standard-instance wrapper)))
(setq direct-slots
'fsc-instance-slots)
(defmethod raw-instance-allocator ((class funcallable-standard-class))
- 'allocate-funcallable-instance)
+ 'allocate-standard-funcallable-instance)
(defmethod allocate-instance
((class funcallable-standard-class) &rest initargs)
(declare (ignore initargs))
(unless (class-finalized-p class)
(finalize-inheritance class))
- (allocate-funcallable-instance (class-wrapper class)))
+ (allocate-standard-funcallable-instance (class-wrapper class)))
(defmethod make-reader-method-function ((class funcallable-standard-class)
slot-name)
\f
;;;; PCL's view of funcallable instances
-(!defstruct-with-alternate-metaclass pcl-funcallable-instance
+(!defstruct-with-alternate-metaclass standard-funcallable-instance
;; KLUDGE: Note that neither of these slots is ever accessed by its
;; accessor name as of sbcl-0.pre7.63. Presumably everything works
;; by puns based on absolute locations. Fun fun fun.. -- WHN 2001-10-30
:slot-names (clos-slots name hash-code)
- :boa-constructor %make-pcl-funcallable-instance
+ :boa-constructor %make-standard-funcallable-instance
:superclass-name function
:metaclass-name standard-classoid
:metaclass-constructor make-standard-classoid