I think returning futures for asynchronous calls is a good tradition in Clojure world. Better than callbacks because you are leaving the threading model choice in the hands of the caller, which is a good thing.
On Monday, June 1, 2015 at 10:18:19 PM UTC+3, Christopher Small wrote: > > Greetings > > I imagine most of us here would rather use core.async channels over > callbacks in their application code, particularly with more complicated > applications. But is it okay/preferable for Clojure libraries to force > their users to use core.async channels as part of an API (an event channel, > for example)? > > As much as I love core.async, I can't help but wonder whether sticking > with callbacks for an API isn't a simpler/better design strategy. It's easy > enough to drop messages on a channel in a callback, and this let's users > opt-in. But if one expects core.async channels are what most would prefer > anyway, is it okay to foist them upon everyone? > > As a follow up, does your opinion on the matter change if implementations > of an API become simpler using core.async channels? > > > Looking forward to your thoughts :-) > > Chris Small > > > > PS I'm asking because I'm working on a physical computing API ( > https://github.com/clj-bots/pin-ctrl) and debating between using channels > vs callbacks for the edge detection functionality (if you're not familiar, > edge detection let's you asynchronously handle changes in pin state, such > as button pushes). If you're interested in this question as it applies > specifically to this application, feel free to join the discussion on our > gitter channel: https://gitter.im/clj-bots/chat > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.