Re: Questions about CLOS



Rainer Joswig <joswig@xxxxxxx> writes:

Methods don't belong to classes. Methods are organized
in generic functions. Common Lisp supports multiple dispatch.
So a method can have more than one arg and dispatch is
over all these arguments.

I took his question to be about the MOP, though he may not have meant
it to be. That is, how one might write a method on the
method-addition mechanism itself, noticing that a method was being
added that specialized on a given class and doing something, perhaps
some kind of trace operation.

It sounds like a possible but admittedly suspect request, especially
for someone just starting out and "just trying to learn", since unless
his teaching text is suggesting implementing aspect-oriented
programming as a good way to learn CLOS, it doesn't sound lke a training
exercise.

Perhaps the right question at this point is: "Why?"

Knowing the intended purpose of this might lead to a very different
discussion. People who are new to a language are often assuming they
should do things in a certain way that may not apply.
.



Relevant Pages

  • Re: Questions about CLOS
    ... Common Lisp supports multiple dispatch. ... So a method can have more than one arg and dispatch is ... bank accounts. ...
    (comp.lang.lisp)
  • Re: Double Dispatch ?
    ... > To understand double-dispatch, what it is and how it works,where to ... dispatch directly, Common Lisp for example. ... In more commonly used languages such as C++ and Java, ... making multiple dispatch more difficult to ...
    (comp.object)