On Thu, Jun 3, 2010 at 1:56 PM, Laurent PETIT <laurent.pe...@gmail.com> wrote:
> If I understand things well, one problem with ruby monkey patching is that
> if a library I use opens a class C and adds a method whose signature is M to
> it, and if in my own code I also open the same class C and add a method
> whose signature is M to it, then the library may break because it will call
> my implementation of M, not the librarie's original one.
>
> Now to clojure. I can see the same problem occur, while the article's author
> claims that in clojure there's (almost) no problem anymore.
> If several libraries, including my program, redefine blindlessly a protocol
> implementation for the same type, then the "last to speak" wins.
> So isn't the problem basically the same ?

my 2 cents:

The surface of the problem is reduced because of namespacing: two
different "fold" methods (with different semantics) from two protocols
won't clash. Plus if there are two extensions of the same protocol to
the same type, they should be rather equivalent since they satisfies
the same semantics.

I think one must only extend a protocol to a type if he owns either
the type or the protocol.


Christophe


-- 
European Clojure Training Session: Brussels, 23-25/6 http://conj-labs.eu/
Professional: http://cgrand.net/ (fr)
On Clojure: http://clj-me.cgrand.net/ (en)

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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