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

What dispatch mechanism should be used for extension points? #2

Open
jjttjj opened this issue Aug 12, 2019 · 1 comment
Open

What dispatch mechanism should be used for extension points? #2

jjttjj opened this issue Aug 12, 2019 · 1 comment
Labels
question Further information is requested
Milestone

Comments

@jjttjj
Copy link
Owner

jjttjj commented Aug 12, 2019

Currently Iboga uses its own "dispatch mechanism", as seen here. Essentially it just keeps a big map in an atom of qualified keywords to maps of functionality implemented for that keyword.

This could also be implemented as multimethods, which has the advantage of being a standard clojure.core feature. However, multimethods feel like they're a bit overkill when they just dispatch on a keyword, and are a bit awkward when we really want to associate data with a keyword and not functionality.

I'm not in love with the naming and terminology of the current setup: set-schema! and "attributes".

@jjttjj jjttjj added the question Further information is requested label Aug 12, 2019
@jjttjj jjttjj added this to the 0.4.0 milestone Aug 12, 2019
@jjttjj
Copy link
Owner Author

jjttjj commented Aug 12, 2019

An example of multimethods being used can be seen here:

iboga/dev/iboga/wip2.clj

Lines 32 to 44 in 4074360

(defmulti filterer
"Takes a qualified request and returns a transducer which filters
incoming messages to respond to for that request"
(fn [[msg-key argmap]] msg-key))
(defmulti taker
"Takes a qualified request and returns a transducers which 'takes'
incoming messages to respond to for that request. Should return a reduced value"
(fn [[msg-key argmap]] msg-key))
(defmulti cleanup
"Cleanup code to run after request has been 'finished'"
(fn [conn [msg-key argmap]] msg-key))

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

No branches or pull requests

1 participant