Async iteration

# John Lenz (9 years ago)

Two things:

Is there a summary of the motivation for "for-await" and "async iteration" in general?

Has there any discussion in not supporting "var" in "for-await" initializers?

# Kevin Smith (9 years ago)

Is there a summary of the motivation for "for-await" and "async iteration" in general?

There's a short section at: tc39/proposal-async-iteration#overview-and-motivation

Has there any discussion in not supporting "var" in "for-await" initializers?

Symmetry with for-of is definitely an important consideration. Is there a particular reason why you think "var" should be disallowed?

# John Lenz (9 years ago)

On Mon, Mar 14, 2016 at 11:19 AM, Kevin Smith <zenparsing at gmail.com> wrote:

Is there a summary of the motivation for "for-await" and "async iteration"

in general?

There's a short section at: tc39/proposal-async-iteration#overview-and-motivation

Thanks

Has there any discussion in not supporting "var" in "for-await" initializers?

Symmetry with for-of is definitely an important consideration. Is there a particular reason why you think "var" should be disallowed?

There is not a backward compatibility concern and "var" is a smell for all the reasons that "let" was introduced (per-interation bindings don't happen, it isn't scoped to the block). (I'm unclear why "for-of" allows "var" for the same reason). I'm not convinced 100% either way, I was just wondering if it was discussed.

# Benjamin Gruenbaum (9 years ago)

I would be super surprised if I could use var everywhere except async iteration.

So I'd say consistency triumphs. Same reason all the ES2015 features exist in non-strict mode.

Also, you might want to look at the async/await pep for why Python has added async iteration in 3.5

# Isiah Meadows (9 years ago)

By the way, I think observables are getting more headway than async generators.

zenparsing/es

# Benjamin Gruenbaum (9 years ago)

Observables and async iterators are not at-odds. The two proposals complement each other and address two sides of the same coin (pull and push).

I'm also not sure what "headway" means here but a few months ago the observable counterpart to using the async for loop - the for.. on loop proposed by Jafar has been (possibly temporarily) scrapped in favor of async iteration with async iterators.

# Isiah Meadows (9 years ago)

I'm referring to async generators primarily, though. And observables do have the forEach method to listen and iterate with.

# Domenic Denicola (9 years ago)

From: es-discuss [mailto:es-discuss-bounces at mozilla.org] On Behalf Of Isiah Meadows

By the way, I think observables are getting more headway than async generators.

This is very inaccurate. They have gotten more conference talks, but not more committee headway.

# Isiah Meadows (9 years ago)

Ok. I'll take that back then. (I wasn't 100% sure, anyways.)