I scouted PureScript today.
They have an interesting operation when requiring namespaces (importing modules) called “Merging Modules” that allows referring to names from multiple namespaces under a common alias within the requiring ns. They encourage using by explicitly listing the names you wish included, amounting to
select-keys on each of the ns maps, followed by a
merge under the local alias.
Clojure’s ns macro is likely frozen (which brings me great inner peace), but it’s still fun to consider the design as a thought experiment.
I believe it’s a similar thrust to what @ztellman did with
import-vars in Potemkin, allowing the organization of names for the implementor independence from organization for the library consumer. One reason I don’t use that lib more often is I don’t think it works across CLJC targets (particularly CLJS). No idea whether it could be made to work or whether there’s a deeper limitation.
Regardless, from time to time I definitely want this ability in my own projects, both for well-known “suites” of libraries (eg Ring, as Zach mentions), and for some of my own.
Anyone else relate? If supported at the language level and across CLJC targets, would you use it?