Re: reacting to an article on clojure protocols, ruby monkey patching, and safety

2010-06-03 Thread Laurent PETIT
2010/6/3 Meikel Brandmeyer > Hi, > > Am 03.06.2010 um 21:51 schrieb Laurent PETIT: > > >> (in-ns 'some.other.namespace) > >> > >> (let [orig-x some-x] > >> (defn some-x > >>[foo] > >>(if (my-foo? foo) > >> (do-stuff foo) > >> (orig-x foo > > > > Sorry Meikel, but I'm having

Re: reacting to an article on clojure protocols, ruby monkey patching, and safety

2010-06-03 Thread Laurent PETIT
2010/6/3 Stuart Halloway > > May I add this policy concerning Clojure protocols (as well as the rule > "one must only extend a protocol to a type if he owns either the type or the > protocol. If one breaks the rule, one should be prepared to withdraw should > the implementor of either provide a d

Re: reacting to an article on clojure protocols, ruby monkey patching, and safety

2010-06-03 Thread Laurent PETIT
2010/6/3 Rich Hickey > [...] > I don't have a means to prevent this at present, but I'd like to > suggest this policy moving forward: > > If a protocol comes with Clojure itself, avoid extending it to types > you don't own, especially e.g. java.lang.String and other core Java > interfaces. Rest

Re: reacting to an article on clojure protocols, ruby monkey patching, and safety

2010-06-03 Thread Meikel Brandmeyer
Hi, Am 03.06.2010 um 21:51 schrieb Laurent PETIT: >> (in-ns 'some.other.namespace) >> >> (let [orig-x some-x] >> (defn some-x >>[foo] >>(if (my-foo? foo) >> (do-stuff foo) >> (orig-x foo > > Sorry Meikel, but I'm having trouble following you today. > Does the above examp

Re: reacting to an article on clojure protocols, ruby monkey patching, and safety

2010-06-03 Thread Stuart Halloway
> May I add this policy concerning Clojure protocols (as well as the rule "one > must only extend a protocol to a type if he owns either the type or the > protocol. If one breaks the rule, one should be prepared to withdraw should > the implementor of either provide a definition") to the assembl

Re: reacting to an article on clojure protocols, ruby monkey patching, and safety

2010-06-03 Thread Laurent PETIT
2010/6/3 Rich Hickey > > > On Jun 3, 9:28 am, Laurent PETIT wrote: > > Hi, > > > > 2010/6/3 Christophe Grand > > > > > > > > > > > > > On Thu, Jun 3, 2010 at 1:56 PM, Laurent PETIT > > > > wrote: > > > > If I understand things well, one problem with ruby monkey patching is > > > that > > > > i

Re: reacting to an article on clojure protocols, ruby monkey patching, and safety

2010-06-03 Thread Laurent PETIT
2010/6/3 Meikel Brandmeyer > Hi, > > Am 03.06.2010 um 16:16 schrieb Laurent PETIT: > > > I think I clearly understand the benefits of namespaces in this case. I > was reacting to Meikel's sentence: > > > > "And redefining things in foreign namespaces is rather not a technique we > should support.

Re: reacting to an article on clojure protocols, ruby monkey patching, and safety

2010-06-03 Thread Meikel Brandmeyer
Hi, Am 03.06.2010 um 16:16 schrieb Laurent PETIT: > I think I clearly understand the benefits of namespaces in this case. I was > reacting to Meikel's sentence: > > "And redefining things in foreign namespaces is rather not a technique we > should support..." I think what I meant was mentione

Re: reacting to an article on clojure protocols, ruby monkey patching, and safety

2010-06-03 Thread Rich Hickey
On Jun 3, 9:28 am, Laurent PETIT wrote: > Hi, > > 2010/6/3 Christophe Grand > > > > > > > On Thu, Jun 3, 2010 at 1:56 PM, Laurent PETIT > > 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 who

Re: reacting to an article on clojure protocols, ruby monkey patching, and safety

2010-06-03 Thread Laurent PETIT
2010/6/3 Stuart Halloway > The above point has been answered to Christophe. I was not talking about > the way that namespacing will reduce the problem by allowing different > function names (with probably different semantics) to live in different > namespaces. This is no different than distinguis

Re: reacting to an article on clojure protocols, ruby monkey patching, and safety

2010-06-03 Thread Stuart Halloway
> The above point has been answered to Christophe. I was not talking about the > way that namespacing will reduce the problem by allowing different function > names (with probably different semantics) to live in different namespaces. > This is no different than distinguishing 2 ordinary function

Re: reacting to an article on clojure protocols, ruby monkey patching, and safety

2010-06-03 Thread Laurent PETIT
Hi, 2010/6/3 Meikel Brandmeyer > Hi, > > On Thu, Jun 03, 2010 at 01:56:36PM +0200, Laurent PETIT wrote: > > > 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 prog

Re: reacting to an article on clojure protocols, ruby monkey patching, and safety

2010-06-03 Thread Laurent PETIT
Hi, 2010/6/3 Christophe Grand > On Thu, Jun 3, 2010 at 1:56 PM, Laurent PETIT > 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 th

Re: reacting to an article on clojure protocols, ruby monkey patching, and safety

2010-06-03 Thread Richard Newman
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.

Re: reacting to an article on clojure protocols, ruby monkey patching, and safety

2010-06-03 Thread Konrad Hinsen
On 3 Jun 2010, at 13:56, Laurent PETIT 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

Re: reacting to an article on clojure protocols, ruby monkey patching, and safety

2010-06-03 Thread Christophe Grand
On Thu, Jun 3, 2010 at 1:56 PM, Laurent PETIT 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 signatu

Re: reacting to an article on clojure protocols, ruby monkey patching, and safety

2010-06-03 Thread Meikel Brandmeyer
Hi, On Thu, Jun 03, 2010 at 01:56:36PM +0200, Laurent PETIT wrote: > 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 > implement

reacting to an article on clojure protocols, ruby monkey patching, and safety

2010-06-03 Thread Laurent PETIT
Hello, The following article: http://kirindave.tumblr.com/post/658770511/monkey-patching-gorilla-engineering-protocols-in claims that, as far as code safety is concerned, clojure's solution is far better than e.g. ruby monkey patching. If I understand things well, one problem with ruby monkey p