Subject: [clisp-list] MOP compatibility issue

From: "David E. Young" <[email-masked]>
Date: Wed Sep 12 14:20:01 2001

Greetings. The following code works fine in ACL, LispWorks and CMUCL, but
not CLISP 2.27:

(in-package "CL-USER")

(defclass rocky ()
  ((name :initarg :name
         :accessor name))
  (:metaclass clos:funcallable-standard-class))

(defmethod initialize-instance :after ((self rocky) &rest args)
  (clos:set-funcallable-instance-function
   self #'(lambda (a b)
            (format t "Name is ~S; A is ~S; B is ~S~%"
                    (name self) a b))))

(defun make-rocky (name)
  (make-instance 'rocky :name name))

(funcall (make-rocky "rocky") "boris" "natasha")

The trouble apparently is that CLISP doesn't support funcall'able instances;
i.e. CLOS:FUNCALL-STANDARD-CLASS and its associated functions.

I plan to use this functionality in an upcoming LISA release; are there
plans for CLISP in this area?

Regards,

--
------------------------------------------
David E. Young
[email-masked]
http://lisa.sourceforge.net

"But all the world understands my language."
  -- Franz Joseph Haydn (1732-1809)

---

From: Sam Steingold <[email-masked]>
Date: Thu Sep 13 11:07:02 2001

> * In message <0ad901c13bcf$ec203f90$01bba8c0@tinian>
> * On the subject of "[clisp-list] MOP compatibility issue"
> * Sent on Wed, 12 Sep 2001 16:47:57 -0400
> * Honorable "David E. Young" <[email-masked]> writes:
>
> Greetings. The following code works fine in ACL, LispWorks and CMUCL,
> but not CLISP 2.27:
> 

FUNCALLABLE-STANDARD-CLASS is not in ANSI CL.
it's in MOP.

> I plan to use this functionality in an upcoming LISA release;

as I said, this functionality is not in ANSI CL.

there was a discussion on c.l.l on making MOP a part of ANSI CL.
the consensus (expressed by KMP, IIRC) was that this would constrain
implementations to use a particular implementation venue, which is not
desirable.

I see no reason to use FUNCALLABLE-STANDARD-CLASS.  adding a slot
to your standard classes would accomplish almost as much:

(defclass funcallable () ((defun :accessor fdef :initarg :defun)))
(defgeneric call (obj &rest args)
  (:method ((obj function) &rest args) (apply obj args))
  (:method ((obj symbol) &rest args) (apply (fdefinition obj) args))
  (:method ((obj funcallable) &rest args) (apply (fdef obj) args)))

(defclass foo (funcallable) ())
(call (make-instance 'foo :defun #'car) '(1 . 2)) ==> 1

> are there plans for CLISP in this area?

not now.  patches are welcome.

-- 
Sam Steingold (http://www.podval.org/~sds)
Support Israel's right to defend herself! <http://www.i-charity.com/go/israel>
Read what the Arab leaders say to their people on <http://www.memri.org/>
Binaries die but source code lives forever.

---

From: "David E. Young" <[email-masked]>
Date: Thu Sep 13 11:35:02 2001

----- Original Message ----- 
From: "Sam Steingold" <[email-masked]>
To: "David E. Young" <[email-masked]>
Cc: <[email-masked]>
Sent: Thursday, September 13, 2001 2:06 PM
Subject: Re: [clisp-list] MOP compatibility issue

> FUNCALLABLE-STANDARD-CLASS is not in ANSI CL.

Yes, that's correct. It is indeed part of the MOP.

> implementations to use a particular implementation venue, which is not

Thanks for info; perhaps I'll reconsider my approach.