Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Multiple dispatch

2 views
Skip to first unread message

Fernando

unread,
May 14, 2004, 10:56:06 AM5/14/04
to
Hi,

Can someone please explain how CLOS selects the appropriate GF based on the
types of the arguments? O:-)

Thanks

Lars Brinkhoff

unread,
May 14, 2004, 11:35:14 AM5/14/04
to
Fernando <f...@NOSPAMeasyjob.net> writes:
> Can someone please explain how CLOS selects the appropriate GF based on the
> types of the arguments? O:-)

You probably want to know about method selection and combination:
http://clhs.lisp.se/Body/07_ff.htm

--
Lars Brinkhoff, Services for Unix, Linux, GCC, HTTP
Brinkhoff Consulting http://www.brinkhoff.se/

mikel

unread,
May 14, 2004, 11:54:18 AM5/14/04
to
Fernando wrote:

Someone else already posted a link to the Common Lisp Hyperspec, which
will give you all the details of how it's specified to work. The
implementation details vary, of course, from one implementation to another.

The basic idea is that a generic function knows about an argument list
and some methods. When you call the generic function, it looks at the
actual arguments and figures out their types. Then it finds the method
that best matches that set of types and calls it with the actual arguments.

The HyperSpec better explains things like 'best matches' and 'figures
out their types' and so on.

Kaz Kylheku

unread,
May 14, 2004, 6:26:35 PM5/14/04
to
Fernando <f...@NOSPAMeasyjob.net> wrote in message news:<heg9a0p3sj19t7akd...@4ax.com>...

> Hi,
>
> Can someone please explain how CLOS selects the appropriate GF based on the
> types of the arguments? O:-)

This material is covered in the HyperSpec, 7.6.6 Method Selection and Combination.

Paul F. Dietz

unread,
May 14, 2004, 10:28:07 PM5/14/04
to
Fernando wrote:

> Can someone please explain how CLOS selects the appropriate GF based on the
> types of the arguments? O:-)


This paper describes how it was done in PCL

http://www2.parc.com/csl/groups/sda/publications/papers/Kiczales-Andreas-PCL/for-web.pdf

Paul

0 new messages