Hacker News new | past | comments | ask | show | jobs | submit login




I couldn't find example in the docs for that library showing concurrent async ops with simple try/catch type error handling. So it's still not clear to me how you would rewrite the above shown async/await concurrent scenario using this library.


Just use promesa/all then catch :)

Moreover, it has funcool/cats bindings, so you can use promises in mlet and alet macros if you are into monad thing ;)


Oh right, that makes sense but does not make async code organize the way synchronous code does (as async/await sugar enables) but is a fair deal if you don't mind your async code using a different organizing pattern or if you specifically want it to be that way... :)

Re: cats

Not a big fan of abstractions that don't contribute to code simplicity. What is the percentage of programmer who dig monads? Less than 1% probably.


You're just cherry picking though. When it comes to complexity there's plenty more of it in Js than there's ever likely to be in ClojureScript.


I am biased. Just as you are.


Objectively speaking, Js is a far more complex language than ClojureScript.


It's a trivial matter to wrap promise/all in a core.async channel, providing the exact orginzation pattern you're looking for.


Show me the code! Go ahead and let's see how pretty that is, and son't forgeg error handling and concurrency.


I've provided all the code you need to put the pieces together quite trivially. Using go-catching, <? and the promise library (or just the core.async snippet I wrote earlier), you should be able to write the following:

(go-catching (<? (async-all [asyncOpA asyncOpB asyncOpC])))

And yes, that handles errors exactly like synchronous code does. The total number of lines for implementing go-catching, <? and async-all shouldn't take more than 20-30 loc, if not less.

Now, if 20-30 loc is too much for you to write, then by all means use JS.


So what you're saying is that you can't be arsed to spend 15 minutes to learn a library, but you're ok gobbling up all of ES6/7 without problems?


That's an argument plot, not a genuine question. :)


ah so just trolling then :P




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: