technomancy / slamhound

Slamhound rips your namespace form apart and reconstructs it.
Other
473 stars 38 forks source link

clojure.set/join getting chosen over clojure.string/join #22

Closed AlexBaranosky closed 11 years ago

AlexBaranosky commented 11 years ago

If a namespace uses clojure.string/join, but also includes clojure.set, it seems to always choose set/join over string/join.

technomancy commented 11 years ago

This is for :refer rather than :as, right?

AlexBaranosky commented 11 years ago

yes, for :refer. It sees both as being present in the original ns, so it then choose by alphabetical sort (I think). 99% of the time you want clojure.string/join. I've actually yet to use clojure.set/join...

technomancy commented 11 years ago

We should probably get it to prefer :as candidates when the last segment of the ns matches the alias used, but that doesn't help for :refer.

I don't think it's feasible to get in the business of maintaining a preferences list just because the scope of such a thing would potentially be almost limitless.

We could possibly search for user-specified preference rules, but the implementation of that could get hairy. Maybe if it were just read-string on a dotfile? Even then supporting project-level rules vs user-wide ones could be tricky.

AlexBaranosky commented 11 years ago

This code seems to work: https://github.com/technomancy/slamhound/pull/24

guns commented 11 years ago

Fixed by #24