In larger code bases & teams, it is possible that different folks 'require' a namespace with a different alias
h.clj
(ns hello.core)
f.clj
(ns foo.core
(:require [hello.core :as hc]))
b.clj
(ns bar.core
(:require [hello.core :as h]))
If you see, big projects I have worked on often ends up having different aliases for the same namespace even though conventions are kept in place. This is a human flaw and in bigger teams this often goes out of track. This makes it harder to use simple tools like grep e.t.c to find usages of namespaces and functions within them (by doing say hc/some-func
or h/some-func
in the above case)
What I want to propose is in the ns macro itself have something like
(ns hello.core :default-alias <my-alias>)
and wherever this ns is require'd
(ns foo.core
(:require [hello.core :default-alias])
we automatically get a <my-alias>
referencing the namespace so we can do <my-alias>/some-func
This would lead to a consistent code that will be enforced on language level
I believe this could be done using some sort of metadata stored in the namespace