Echo JS 0.11.0

<~>
MaxArt 2682 days ago. link 4 points
Sad news, but cancelable promises have always been on a problematic path. To be honest, the whole "promise" thing, while having some undeniable advantages, has some quirks that prevent a really good coding experience.

The inability to cancel a promise with a meaningful outcome is one of those things. We adopted promises and build a whole new syntax (async/await) around it, without thinking about future developments.

The fact is that promises are meant to be a simple tool to organize our code flow, and yet under - and even over - the hood they're not.

We'll have to wait for Observables to solve out control flow problems (hopefully). They're not simple, but at least they don't pretend to be.

Anyway, thank you Domenic Denicola for your effort. I don't think it's been in vain, for the whole community.

Replies

blai 2682 days ago. link 1 point
Would you choose RxJs over Promise now?
MaxArt 2682 days ago. link 1 point
It's not like one excludes the other, as they have different purposes. Promises are good for one-time events, while observables are meant for streams of events. It becomes problematic when we try to bend one to do the job of the other.

For example, right now we have a nice `fetch` API that *seems* to be perfect for promises (we've been using them since jQuery implemented `done` and `fail`), but now we've not only lost the ability to cancel a request, but also to watch for the progress in uploading the request and downloading the response.

You wouldn't use a Promise to listen to a click event, either.

Conversely, using observables for simple tasks (for example, getting a Blob out of a <canvas>) introduces unnecessary syntactic clutter.

The problem now is that we have native Promises, but still no native Observables.
lordgreg 2681 days ago. link 1 point
Um... that Promises too advanced are could I understand for complex things that would in all cases be complex and overdeveloped.

However, not even once in my last Year of trying to get into RxJS aka Observables wasn't I amazed in any way. Not only amazed but stressed about the docs and examples. 

I would NEVER, use Observables over Promises in any of my current apps. Reading "Angular 2 is terrible" makes a perfect example about the whole "Observables" pattern usage. 

I would, however, completely agree with you- I would NEVER use Observables for a simple tasks. But until today, noone gave me any special PROs about Observables because of which I would switch immediately to RxJS. 

Angular team (Google) is forcing Observables pattern into JS world. Is this really really needed?

People aka. us, developers, always forgot to keep it simple. Do not overdevelop, as Angular did.
MaxArt 2681 days ago. link 1 point
Well, as I said, you don't have to *switch* - you can use them both, like you can do in Angular 2.

The odd thing is that we've been using "observables" since, like, forever. Of course not of the kind we have in RxJS, but we have events (the "observables") and listeners (the "subscribers"), and we lacked all the semantic syntax ofr transformation and manipulation such as map, forEach and so on. So, theoretically, it *shouldn't* be that hard to grok Observables.

But it kind of is, because of the mentioned sematic syntax which could be quite jarring from the usual procedural style.

But yes, Observables are somewhat needed. Maybe not in this form, but the concept behind them is necessary because, as I said, not everything could be achieved with a Promise.
lordgreg 2677 days ago. link 1 point
Thank you for your reply. Appreciate it.

And that is also the point, Observables are the "next big thing", however... no one can't explain what would we use them for.

:)