[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Method-lambda and apply-method-lambda

    Date: Fri, 25 Mar 88 14:38:09 CST
    From: Patrick H Dussud <DUSSUD@Jenner.csc.ti.com>

I have two kinds of comments about your proposal.  I have some minor
comments about the details of the proposal itself as well as some
serious questions about whether it can work.

I will start with the minor nits.

                         LAMBDA-FORM &optional MACROEXPAND-ENVIRONMENT

Since, as you say, the method function captures the contract between a
class of generic function and a class of method, I think this generic
function should receive the prototype method as an argument as well.

I am not sure that I want to have to pass the method to apply-method?
If I am going to pass the method, why don't I also pass the generic

Also, I am pretty sure we want to make compile work on these, which
brings me to my second point.

How does one write the following code in your proposal:

(defun advise-1-arg-method (method)
  (let ((function (method-function method)))
    (reinitialize-instance method
       :function #'(method-lambda (a)
                     (format *trace-output* "~&Got arg ~S" a)
                     (funcall function a)))))

The point is that in this case the `method function lambda' appears
lexically in the source code.  That means that it can capture the
lexical variable function.  It also means that it is compiled at
compile-file time.

I think both of these are important properties.  Perhaps the solution is
to have the generic function you say, but specify in addition that the
standard method returns (METHOD-LAMBDA (..) ...).