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
Iterators can have side-effect but in many cases, e.g. when iterating arrays, they are side-effect free. This is a follow-up for #3126. Once this is implemented, for..of will always be penalized, which could be improved.
Feature Proposal
A sophisitcated solution could track Symbol.iterator and Symbol.asyncIterator properties and check the side-effects of their return values' next function. Such a logic should also work for spread operators and manual iteration as well as interact properly with generators. It should also be tested for side-effects when passed to a function such as Array.from.
The text was updated successfully, but these errors were encountered:
Feature Use Case
Iterators can have side-effect but in many cases, e.g. when iterating arrays, they are side-effect free. This is a follow-up for #3126. Once this is implemented,
for..of
will always be penalized, which could be improved.Feature Proposal
A sophisitcated solution could track
Symbol.iterator
andSymbol.asyncIterator
properties and check the side-effects of their return values' next function. Such a logic should also work for spread operators and manual iteration as well as interact properly with generators. It should also be tested for side-effects when passed to a function such asArray.from
.The text was updated successfully, but these errors were encountered: