The ES6 iteration protocol

2015-03-28 Thread Axel Rauschmayer
FWIW: I have written down my understanding of the ES6 iteration protocol (shaped by discussions I had on this mailing list). https://gist.github.com/rauschma/73e5f86a595b7709f39e -- Dr. Axel Rauschmayer a...@rauschma.de rauschma.de ___ es-discuss m

Re: Re: Does async/await solve a real problem?

2015-03-28 Thread jordi baylina
I propose that all the calls to any async function will be implicit (without the need of the await keyword). And precede it with a nowait only when you want a promise. See this snipped proposal: https://gist.github.com/jbaylina/692d4e43329c8c0d22dd This way, the code will not have the async clut

Promises vs Streams

2015-03-28 Thread Boopathi Rajaa
I feel this must have already been discussed but couldn't find any discussion threads, just trying to understand them better. The basic doubt is that I feel promises are more like streams, and that streams are much more powerful than promises. With a promise you have a value or an exception, and w

Re: Promises vs Streams

2015-03-28 Thread Anne van Kesteren
On Sat, Mar 28, 2015 at 1:14 PM, Boopathi Rajaa wrote: > Why do we have both? Why do we have both values and arrays, not just the latter? -- https://annevankesteren.nl/ ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listi

Re: Promises vs Streams

2015-03-28 Thread joe
Maybe the confusion stems from how Promises were used in ES5? ES5 doesn't support generators, so people ended up adding a sort of psuedo-generator API to their promise APIs, but in reality the concepts solve different problems? FYI, python seems to use promises and event streams together in its a

Re: Promises vs Streams

2015-03-28 Thread Axel Rauschmayer
Synchronously, we have both normal (synchronous) function calls and iteration over a sequence of values (via `for-of` and iterators). It makes sense that we also should have two abstractions for asynchronous interaction. > On 28 Mar 2015, at 13:14, Boopathi Rajaa wrote: > > I feel this must ha

RE: Promises vs Streams

2015-03-28 Thread Domenic Denicola
The same argument also implies that arrays are more powerful than scalar values, and we should e.g. never use a number when we could instead just use a single-element array with a number. From: es-discuss [mailto:es-discuss-boun...@mozilla.org] On Behalf Of Boopathi Rajaa Sent: Saturday, March

RE: Promises vs Streams

2015-03-28 Thread Domenic Denicola
Seeing as how I just produced a completely redundant message by failing to read the other responses before firing off my own, let me try to redeem myself with some more-original content. It’s also important to realize that streams are not the only asynchronous-plural primitive out there. My fav

Re: Promises vs Streams

2015-03-28 Thread Brendan Eich
Domenic Denicola wrote: Seeing as how I just produced a completely redundant message by failing to read the other responses before firing off my own, let me try to redeem myself with some more-original content. (Nice post!) It’s also important to realize that streams are not the only asynchr