
On Aug 23, 2009, at 10:00 AM, Mathias Gaunard wrote:
OvermindDL1 wrote:
Hmm, I know LISP has a well optimized multimethod implementation written in pure LISP, wonder how easily that method could be transferred to C++, although more verbose...
Lisp is dynamically typed, so the implementation of multimethods is simply that of overloading.
This sentence is a bit oxymoronic. A dynamically typed language has no way to overload anything, i.e. overloading is a feature found in languages where type can be expressed and dispatched upon. Disregarding the oxymoronic quality, why is this implication natural (dynamic ---> multimethod == overloading...)? That said, yes, in CLOS one can extract type information (a tag) and match it against the special form arguments provided to a "method" (ad- hoc multipolymorphic operator...). So, in that sense, CLOS is not completely dynamic, since type information can be expressed statically (in these special 'defmethod' forms) and matched against through a specialized pattern matching mechanism. /David