From: Joel VanderWerf Date: 2008-10-16T10:51:15+09:00 Subject: Re: Sample for Metaprogramming Chad Perrin wrote: > On Thu, Oct 16, 2008 at 04:53:04AM +0900, Sebastian Hungerecker wrote: >> Chad Perrin wrote: >>> I'm aware of the existence of CLOS, but don't really know anything about >>> its specifics of implementation and use. How does it handle the kind of >>> functionality that, in Ruby, consists of sending messages to objects to >>> invoke their methods? >> It doesn't, really. CLOS methods are overloadable functions basically, i.e. >> you can define multiple methods of the same name, but with different argument >> types, and it'll pick the right one to call depending on the type(s) of the >> object(s) you pass as arguments. There's no concept of a receiver though. > > So, basically, instead of real methods, CLOS just uses . . . what? > Parametric polymorphism? This isn't meant as a challenge or complaint, > but rather just a question so I'll understand it better: IIRC: CLOS uses generic functions, aka multimethod dispatch. Think of a hash table that maps n-tuples of classes to implementation functions. -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407