News for hackers. Stuff that matters.

mad-mad-beaver

Re:React/JavaScript fatigue on Tuesday December 29, 2015 @01:55AM (#10805614)
Oh, yeah, it replaces that cumbersome

.then(() => doSome(thing)) with bare doSome(thing)

and

.catch(err => doOtherThing(err)) with catch (err) {doOtherThing(err)}

A breakthrough indeed!

I just don't see how's that fundamentally different and why one should have synchronous-like semantics for async operations.

Moreover I do a lot of RxJS and like stuff and it's perfectly normal for me to have async computations steps wrapped in functions. Luckily no one tried to "improve" JS syntax specifically for RxJS.

So I totally get async/await syntax and semantics but it forces me to switch mental context for no good reason and thus is useless and disconcerting.

And it's ridiculous to see this minor "feature" as a reason to switch from CLJS to ES6/ES7

Re:React/JavaScript fatigue on Monday December 28, 2015 @05:37PM (#10803828)
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 ;)

Re:React/JavaScript fatigue on Monday December 28, 2015 @05:16PM (#10803723)
How is "never-ending-chain-of-thens" fundamentally different from async/await? It's still the very same code but with different (and somewhat disconcerting) sugar. I've been using promises long before ES7, and it's actually harder for me to read async/await functions and reason about them because they look so much like ordinary functions but aren't. There are useful features in ES6/ES7, to be sure: fat arrows, destructuring, imports/exports. Classes and spreads are useful too if you do a lot of React and JSX. But async/await, decorators and generators are just fancy and questionable ways to perform routine functional stuff one can easily do in shaggy pre-ES5 Javascript. I write a lot of ES6/ES7/JSX at work and CLJS at home and 100% prefer the latter. I want immutable values with destructuring, lazy sequences, suit of threading macros, decent cond|p/case, protocols and whole CLJS ecosystem. I've adapted to ES6/ES7/Redux/RxJS and often even could write code near-identical to CLJS/Reagent/Re-frame/Reagi stack. But it is definitely more painful and limiting experience.