Closed Bug 825801 Opened 9 years ago Closed 6 years ago

[meta] Replace use of for each...in statement in Firefox UI/app JS code with for..of

Categories

(Firefox :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: tetsuharu, Unassigned)

References

Details

ECMA-357(E4X) is deprecated.
We should reduce to use of for each...in statement.
Blocks: 791343
Depends on: 791348, 825800
Summary: Remove use of for each...in statement → Remove use of for each...in statement from Firefox
B2G Gaia Browser: Bug 824100
Thunderbird: Bug 824104
Summary: Remove use of for each...in statement from Firefox → [meta] Remove use of for each...in statement from Firefox
Depends on: 791352
Depends on: 826329
Before removing for..each entirely, please consider:
"for..each" is very useful, makes the code a lot clearer.

for each (var item in array)
vs.
for (var item of array)
vs.
for (var i = 0; i < array.length; i++) {
  var item = array[i];
}

Unfortunately, for..of can't replace for..each. For example, when iterating over a plain object
var obj = { foo: 1, bar: 2}:
for each (var value in obj)
vs.
for (var [, value] of Iterator(obj))
for..of is nowhere near as clear to read (most important), nor convenient to type.

My plea: Before removing for..each, make sure that there is a replacement that is just as (or more) capable, clear/lean and convenient. Code readability has uttermost importance for me.
Sorry, ignore last comment, I misunderstood. I thought this was about the engine.
Summary: [meta] Remove use of for each...in statement from Firefox → [meta] Replace use of for each...in statement in Firefox UI/app JS code with for..of
Depends on: 872576
Blocks: 925989
All blocking bugs are fixed and other use are also removed in other bugs that blocks bug 1083470.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.