I have a variation on rick’s question, in fact
My foo.system
ns tends to have a ton of requires since it orchestrates all the other components. no big deal generally, but now I have a project where I want to build separate client and server artifacts, and only include in the uberjars the necessary dependencies
The one foo.system
ns inhibits that. How bad an idea is it to inline the requires when building a component? E.g.
(defn build-console
[]
(require 'bleach.system.console)
(bleach.system.console/system-console))
@donaldball I do that for test systems — each component has a test-system
function that can be used by unit/integration tests to build a testable system and I do the require
at runtime there so only the test tasks (in build.boot
need to bring in the actual dependencies).
donaldball the problem with that is that build-console won't compile as written. But using resolve fixes that replace the call with ((resolve 'bleach.system.console/system-console))
inner parens find the var, outer invoke it, and vars call their function value when invoked