Fork me on GitHub

How frequently do you find yourself doing the my.namespace.api + my.namespace.api.async pattern when interacting with APIs? Is it step 1 for wrapping an api? I've found I almost always want (identical) async and non async interfaces and this pattern has been the nicest to use as a user of the wrapped api. But it does kinda lead to a lot of namespaces in apps that wrap a lot of things

Ben Sless17:04:37

I usually default to an async implementation which takes a callback, and a blocking arity which delivers a promise on that callback and returns derefs it. Callbacks can easily be adapted to different async libraries


the api clients I have written lately end up following a aws-api like pattern where the api is kind of a single function "invoke" that takes a map describing some operation to perform and returns the result, and I often have an invoke! which returns a channel, and invoke!! which calls invoke! and then calls >!!