Closed benlesh closed 10 years ago
To be clear, I'm not specifically saying "await" is the best idea, or even a good idea. I'm simply saying that on
and in
might look too similar when skimming code.
Once I'm sure this is seen, I'm closing this myself, because it's probably not a big deal, but I wanted to at least express the concern. in
, on
and of
all look very similar when skimming code, they each have distinct typographic "coastlines", but do not differ at all in word size, and barely differ in letter content across in
-> on
-> of
despite being only two letters each. on
is the joining factor there between in
and of
You're not alone. I've thought the same thing. in, of, on..
I'm the kind of dev who would rather be verbose if it makes it easier to understand/read.
I'd need to check to grammar, but I believe you should still be able to do:
for (let foo of await foos()) {}
Or even:
for (let [key, foo] in await foos()) {}
Maybe C# is throwing me off though. When I have some time I'll check the grammar. (of course someone may chime in before)
I don't disagree necessarily with these concerns. However this issue was really settled with the addition of "for...of" in ES6. ES6 sets the principle that we shouldn't go too far to differentiate these with very different looking concepts. The "for...on" loops follows that principle.
This might be a small thing, but I worry that many developers might run into hard to suss out issues when debugging code using the syntax as proposed. I was in a hurry the first time I looked at this document and I thought it was a
for ..in
block. But that puzzled me because I couldn't figure out how the parser would know to treat the async iterator differently. It took me a few reads to realize it wasfor ..on
. Now I'm a little jet-lagged, so maybe that isn't helping, but wouldn't afor ..await
be more descriptive and easier to read?