dime
dime copied to clipboard
Allow exposing multiple entries
Currently, ^:expose exposes only one object/entry. In some cases, initialization functions (e.g. instrumentation functions that produce instrumented thread-pool/Ring-handler pair) may produce more than one entry to be exposed and used together.
The ^:expose metadata should allow a vector of entries, e.g. ^{:expose [:thread-pool :ring-handler]}. This may be applicable only with singleton-producing fns, typically annotated with {:post-inject dime.util/post-inject-invoke}.
I think maybe you could just reexport it no?
(defconst ^:expose ring-handler [^:inject thread-pool] thread-pool)
nm I thought you were trying to export same var as multiple names... sometimes that makes sense too, but in trying to figure out how a thread-pool could be a ring handler I realized you weren't trying to alias the same object but to export values from a result vector. I guess you could name the vector and then extract each in turn, but a less verbose method seems useful.
(defconst ^:expose ring-handler [^:inject instrumentation-result] (first instrumentation-result))
@kurtharriger Yes, this can be achieved in an indirect way as you described, and as you observed this feature-request will make it less verbose. Allowing direct exposure of specific named entries would hopefully provide the following benefits:
- make the initialization process less convoluted
- make the dependency artifacts explicitly visible (e.g. for tooling)
For reference, I was recently working on web server thread-pool instrumentation and realized Dime could use this enhancement to make things smoother.