Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow exposing multiple entries #7

Open
kumarshantanu opened this issue Dec 22, 2021 · 3 comments
Open

Allow exposing multiple entries #7

kumarshantanu opened this issue Dec 22, 2021 · 3 comments

Comments

@kumarshantanu
Copy link
Owner

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}.

@kurtharriger
Copy link

I think maybe you could just reexport it no?
(defconst ^:expose ring-handler [^:inject thread-pool] thread-pool)

@kurtharriger
Copy link

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))

@kumarshantanu
Copy link
Owner Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants