On Tue, Mar 24, 2009 at 5:37 PM, Meikel Brandmeyer <m...@kotka.de> wrote:

> Hi,
>
> Am 24.03.2009 um 22:36 schrieb mikel:
>
>  CLOS says that if two matches are otherwise equally specific, the one
>> on the left wins. Similarly, it says that if two classes define slots
>> with the same name, the one farthest from the root of the class
>> heterarchy (as defined by a standard traversal algorithm) wins. You
>> can make a theoretical argument that these choices are arbitrary, and
>> that the programmer should control those decisions. In practice, the
>> CLOS approach is not a problem because:
>>
>
> Thank you for the long explanation. Please allow me to be sceptical
> (fatigued and after all long day of work). CLOS is certainly a powerful
> system, but reading these rules makes me headaches.
>

Interestingly enough the rules described above seem to be exactly how
multiple inheritance works in Python, and they seem to me pretty easy to
understand. Imagine that you specify interfaces left to right in order of
importance, and therefore when a generic function is defined for two of them
the leftmost one wins. Should you happen not to remember though you can
quickly try out an example at the REPL. I do that all the time in Python
when I want to verify that what I remember is in fact correct.

-- 
Cosmin Stejerean
http://offbytwo.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to