could you have a macro that rewrites code to use your ops?(require '[clojure.core.matrix :as m])(m/with-ops (+ ... (* ...) ...))
You only get the warning if you 'use' the namespace or 'refer all'
tho', correct?
And we've recently seen a lot of discussion that basically says "don't
do that" so it seems that either users of core.matric are going to
have two "approved" choices:
* require core.matrix with an alias, or choose to rename colliding
names however you want
* exclude the colliding symbols via refer-clojure and require them
from core.matrix as referred symbols
That's seems right to me: it is explicit and provides no surprises; it
gives the user control over how to manage things.
You received this message because you are subscribed to a topic in the Google Groups "Clojure" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojure/nar5vIAUo1c/unsubscribe.
To unsubscribe from this group and all its topics, send an email to clojure+u...@googlegroups.com.
I just think the default behaviour should be super-friendly and not spit out warnings.
On Wed, Sep 4, 2013 at 11:25 PM, Mikera <mike.r.an...@gmail.com> wrote:
> I remember the debates :-) and I don't think there was anything like a
> consensus that "don't do that" is the right answer.
I didn't say there was consensus or that it was right :)
> I'm not against giving the user control. I just think the default behaviour
> should be super-friendly and not spit out warnings.
I don't think it's at all "friendly" to have standard functions
_silently_ replaced by some library I included. I want to know about
the collisions and I want to be able to control how those collisions
are resolved. Or I can explicitly decide to ignore the warnings. But
the warnings _should_ happen.
I haven't tried this, so apologies if it couldn't even work, but have you considered providing a fn in your library intended to be used inside the ns macro? The refer-clojure :exclude boilerplate could be replaced with something like this.
(ns my-thing
(:require core.matrix.ns)
(:core.matrix.ns/exclude-clojure-core-math-ops)
(:use core.matrix))
It's not too much boilerplate, and probably explicit enough for anyone who was going to :refer :all anyway.
(Sorry for butchering your lib's name. Mobile keyboard bad for code.)