Import does not demand name mapping. You can import a full path without aliasing. This will work fine:
(ns multi.core (:require [multi.ns1] [multi.ns2]) (:import [multi.ns1.Animal] [multi.ns2.Animal])) (multi.ns1.Animal. "hi") (But remember to use the keyword :import, not the symbol. This will be tightened up in the future.) On Friday, March 17, 2017 at 4:28:09 PM UTC-5, tmountain wrote: > > Say that I have the following: > > -- ns1.clj -- > (ns multi.ns1) > (defrecord Animal [name]) > > > -- ns2.clj -- > (ns multi.ns2) > (defrecord Animal [name]) > > -- core.clj -- > (ns multi.core > (:require [multi.ns1] > [multi.ns2]) > (import [multi.ns1 Animal] > [multi.ns2 Animal])) > > > My intent is to have a multimethod with target such as: > > (defmethod stringify multi.ns1.Animal ...) > (defmethod stringify multi.ns2.Animal ...) > > My problem is that I'm forced to use import to bring in the records > defined in ns1 and ns2, but once I do this, I lose the ability to refer to > these classes by their fully-qualified names and the following conflict > occurs. > > java.lang.IllegalStateException: Animal already refers to: class > multi.ns1.Animal > > This actually works from the repl, which tells me it's getting the records > onto the classpath ahead of time. > > > > multi.core=> (require 'multi.ns1) > nil > multi.core=> (require 'multi.ns2) > nil > multi.core=> multi.ns1.Animal > multi.ns1.Animal > > I bumped into this in the process of exploring the expression problem. Is > there a way around it? > > -- 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 Note that posts from new members are moderated - please be patient with your first post. 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.