On Sun, May 17, 2009 at 1:40 PM, philip.hazel...@gmail.com < philip.hazel...@gmail.com> wrote:
> > On May 17, 1:14 am, "Michel S." <michel.syl...@gmail.com> wrote: > > In Clojure, it is possible to do the former -- (def orig+ +) -- but it > > appears that overriding a clojure.core definition is not possible. I'd > > love to be wrong on this, though. > > > > user=> (def + -) > > java.lang.Exception: Name conflict, can't def + because namespace: > > user refers to:#'clojure.core/+ (NO_SOURCE_FILE:5) > > This just means you can't create user/+. What you can do is redefine > clojure.core/+. > > user=> (def clojure.core/+ -) > java.lang.Exception: Can't create defs outside of current ns > (NO_SOURCE_FILE:1) > user=> (in-ns 'clojure.core) > #<Namespace clojure.core> > clojure.core=> (def + -) > #'clojure.core/+ > clojure.core=> (in-ns 'user) > #<Namespace user> > user=> (+ 3 1) > 2 > > I'm sure this is something you should avoid, especially given the > other solutions. But the option is there. Aha, thanks for pointing that out. Surely this is not wise to do often, but it is nice to know what the ns issues are. :-) > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---