CLIM mail archive

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

Question concerning methods



    Date: Fri, 5 Jun 1992 17:49+0200
    From: Oliver Christ <unido!adler.philosophie.uni-stuttgart.de!oli>

    Dear CLIMmers,

    I'm currently building an application interface with CLIM (1.0 & 1.1 on Lucid
    and Allegro). One way to detect whether the execution of some code affects the
    representation of interface objects is to provide :after-methods for those
    application functions which might affect the interface state. So, it is not
    necessary to change the application code itself. I don't know if I made this
    clear, so an example would be:

    in the application code:

      (defmethod create-new-application-object (arg1 arg2)
	...)

    in the interface code:

      (defmethod create-new-application-object :after (a1 a2)
	...
	(redisplay-pane ...))

    My problem is now, that the interface code should be independent from the
    application code (and, of course, vice versa), that is, I don't want to "copy"
    the lambda-list of the application code into the after method of the interface
    myself. What I have in mind is a macro which dynamically defines the after
    method and gets the lambda-list from the generic function:

      (define-after-method-for-generic-function 'create-new-application-object
	    ...body...)

    Now, I haven't found a legal way to get the lambda-list of a generic
    function. In Allegro4.1, it is in the slot "CLOS::PRETTY-ARGLIST", in
    Lucid, it is in the slot "CLOS::LAMBDA-LIST" of the generic function
    object. 

    My question is whether anybody has found a legal (Ansi-Draft-Conforming...)
    way to get the lambda-list of a generic function object.

Well, this question does not really belong to this mailing list, because it 
is really concerned about plain CLOS.

Anyway, I propose the following:

1. There is a function called CLOS:GENERIC-FUNCTION-LAMBDA-LIST, which is implemented in
the CLOS versions of Symbolics and Lucid (at least >=4.0 for SUNs). Allegro doesn't support
it, I think. BUT if I understood you correctly, you need the lambda list of your methods,
not generic functions, because in generic functions there are no specializers, which
you do have in methods. So watch out for CLOS:METHOD-LAMBDA-LIST or something like that.

2. I would suggest another way of solving the problem. Write a macro named 
DEFINE-METHOD-FOR-INTERFACE or so, that takes a legal lambda list for CLOS methods
and two bodies/forms. The macro then expands to both the normal method and the :after method
you want to have for your UI stuff. In this solution you don't have to cope with
any CLOS details or internals.

Hope that helps a bit or gives you new ideas,

Markus Fischer, MF@SGER.UUCP              Mergenthaler Allee 77-81
Consulting Services                       W-6236 Eschborn, Germany
Symbolics Systemhaus GmbH                 Phone: +49 6196 47220, Fax 481116


Follow-Ups: References:

Main Index | Thread Index