Another loose end.
With the addition of for-of, for-in reverts back to always iterating over the
property keys of an object as it does not support the generalized iteration
protocols. An implication of this is that using a de-structuring pattern as
the iteration variable has very limited utility:
for (let [c] in obj) print(c); //print the first character of each of obj's
enumerable property names
for (const {length:len} in obj) print(len); print the length of each of obj's
enumerable property names
Given this lack of utility, why should we allow de-structuring in this context?
Eliminating it arguably increases language complexity by introducing in a bit
more grammar irregularity. On the other hand, eliminating useless
functionality can be seen as as simplification.
I'm leaning towards banning destructing in for-in.
Allen
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss