[Openmcl-devel] funcallable instances

Gary Byers gb at clozure.com
Sun Aug 29 16:12:14 PDT 2004

On Sun, 29 Aug 2004, Timothy Moore wrote:

> Hi,
> Here's a patch to support funcallable instances, as specified in AMOP.
> The changes are pretty minor:

> Change defclass to not supply default direct superclasses;


> Change the shared-initialize :after method for slots-class to supply a
> default superclass of funcallable-standard-object for classes with
> metaclass funcallable-standard-class;


> A trampoline for funcallable instances;
> A couple of functions that seem to need implementations for funcallable
> instances.

This basically implements section 5.5.4 of the spec, which is probably.

> I haven't tested this extensively, but it seems to work.

We can certainly implement SET-FUNCALLABLE-INSTANCE-FUNCTION as
a generic function.  Since section 5.5.5 of the spec isn't implemented
(or close to it: there are significant differences in how method functions
receive their args and other issues), I'd be tempted to want to split this

(defmethod set-funcallable-instance-function ((funcallable-instance
  ;; Your implementation here.

(defmethod set-funcallable-instance-function ((funcallable-instance
  (error "Section 5.5.5 of the AMOP isn't implemented in this lisp.
         ~s was called with args ~s and ~s. "
        'set-funcallable-instance-function funcallable-instance function))

Maybe that's overly paranoid, but someone who wants to use
SET-FUNCALLABLE-INSTANCE-FUNCTION to set the discriminating code in
a GF should probably be dissuaded from doing so.  (Maybe letting them
do it once is a good way of dissuading them: how else will they learn ?)

> Tim


More information about the Openmcl-devel mailing list