You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Range/interval comprehension in 'for/while' loops #11381
We could benefit from range/interval comprehension in 'for/while' loops: for (i in 1..10) { someCodeHere(); }
could be optimized by the compiler using the classical for loop construct: for (i=1; i<=10; i++) { someCodeHere(); }
or, with the 'while' construct: while (i in min..max) { ... }
could be comprehended as while (i >= min && i <= max) { ... }
*might also work for other iteration-based constructs and for array/tuple construction, but this is a different story.
ES Discuss is probably a better place to suggest this. TypeScript aims to be a superset of ECMAScript with static typing added. What you are proposing is new language syntax, rather than something related to static typing specifically.
TypeScript would likely only consider this if it was already a fairly advanced proposal for ECMAScript. OTOH, if this gets picked up for a future version of ECMAScript, it will eventually make its way into TypeScript.
Activity
yortus commentedon Oct 5, 2016
ES Discuss is probably a better place to suggest this. TypeScript aims to be a superset of ECMAScript with static typing added. What you are proposing is new language syntax, rather than something related to static typing specifically.
TypeScript would likely only consider this if it was already a fairly advanced proposal for ECMAScript. OTOH, if this gets picked up for a future version of ECMAScript, it will eventually make its way into TypeScript.