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

re: Getting hold of the method object currently executed



> Date: 17 Nov 89  0839 PST
> From: Dick Gabriel <RPG@sail.stanford.edu>

> [In reply to message from gamin@Moe.McRCIM.McGill.EDU sent Fri, 17 Nov 89 09:30:33 EST.]
> 
>    If having access to the method being run is common enough, would it
>    warrant a change to the standard (gasp!) or a special extension?
> 
> I did not save the original comment, so this might be redundant:
> What is the purpose of being able to get a hold of the current method
> that cannot be served by *you* modifying your source code to
> note it whatever way you want? 

I don't have my original request either, but I'll rephrase myself anyway;

I'm more or less modeling a robotic system.  Naturally, the *physical*
objects are modeled as instances of CLOS classes and actions are modeled
as methods.  This was trivial.  Then, we wanted to do task planning and
error recovery; the way we see it, this can be achieved by modeling
actions as *software* objects and reason about these objects.  CLOS can
handle that, since in CLOS methods are also objects.  We proceeded to
create a mixin class out of the standard-method class and the slots we
need to reason about actions (e.g. preconditions, effects on the world,
etc.).  The following step is to make the relevant methods instances of
this 'action-method-class'.

Now, during execution, once we have the method object, we know *what* to
execute and *why* it is executed.  Same for planning.

My request was made for the sake of efficiency; it turns out that every
method of interest to me is called through a macro.  Therefore I do have
access to the generic function-name and to its arguments, but I'm trying
to avoid redundant calls to compute-applicable-methods because I need, for
monitoring purposes, to reason about *every* action-modeling method
executed.  Thus, calling it myself would involve performing method lookup
*twice* per method invocation.


> Looked at another way, why aren't you also proposing to modify Lisp
> to note the currently executing function?

I knew my comment would look a bit like that.  The difference is that I
believe one can do much more with a method object than with a 'function
object'.  I thought I was careful enough not to 'propose' a change because
I am well aware I am dealing with concepts and implications that I don't
master yet.  I guess your opinion is 'no, it does not warrant such an
addition' and that I should pursue another avenue.  That's fine with me.
I am not looking for votes, just opinions and pointers.

Thanks,

Martin