metosin / sieppari

Small, fast, and complete interceptor library for Clojure/Script
Eclipse Public License 2.0
207 stars 21 forks source link

Sugar around async consumption #12

Open arichiardi opened 5 years ago

arichiardi commented 5 years ago

Hello folks!

Today we had a very interesting conversation about consumption from the AsyncContext and the fact that the library could implement a bit more in the protocol and handle quite a bit of boilerplate that always happens to be necessary.

For instance one very common thing that could be abstracted is:

(-> (fn-returning-a-promise)
  (.then #(assoc :result %))

Could be hidden behind the protocol and have something like:

(-> (fn-returning-a-promise)
  (assoc :result))

What do you think?

It would be nice to experiment with this.