I could ignore the warning, no problem, but then I try to use this namespace in another namespace:
(ns random.learning.clojure.usetheoverridexns
(:use random.learning.clojure.overridex)
)
(and
(= false (sorted? '(1 2)))
(= true (sorted? (sorted-set 1 2))))
When I load this namespace first time I get:
WARNING: sorted? already refers to: #'clojure.core/sorted? in namespace: random.learning.clojure.usetheoverridexns, being replaced by: #'random.learning.clojure.overridex/sorted?
true
I could ignore that, but then I load it again(and any subsequent time) and this is an error (not just a warning that can be ignored):
IllegalStateException sorted? already refers to: #'random.learning.clojure.overridex/sorted? in namespace: random.learning.clojure.usetheoverridexns clojure.lang.Namespace.warnOrFailOnReplace (Namespace.java:88)
Notice there's no "true" aka return value.
When I actually close the REPL, and Ctrl+Alt+L load only this latter namespace I get this:
;; Clojure 1.5.0-RC16
;; Switching to random.learning.clojure.usetheoverridexns namespace
WARNING: sorted? already refers to: #'clojure.core/sorted? in namespace: random.learning.clojure.usetheoverridexns, being replaced by: #'random.learning.clojure.overridex/sorted?
true
IllegalStateException sorted? already refers to: #'random.learning.clojure.overridex/sorted? in namespace: random.learning.clojure.usetheoverridexns clojure.lang.Namespace.warnOrFailOnReplace (Namespace.java:88)
and any subsequent loads, show only the part in bold.
While this may be some ccw issue, I am probably also doing something wrong that I could be doing better.
What is the way to do this? especially in the latter namespace which is using the namespace which has overridden the sorted?
I do want the overridden "sorted?" to actually be available and override the clojure.core/sorted? in any namespaces that are using the overridex namespace.
Thank you.
--
Please correct me if I'm wrong or incomplete,
even if you think I'll subconsciously hate it.