`of` operator ES7 proposal from Ian Bicking
brendan at mozilla.org
Mon Mar 30 05:20:12 UTC 2015
Shared publicly - Mar 24, 2015
Huh, "for (attr in obj)" goes along with "if (attr in obj)", but "for
(item of array)" doesn't have an equivalent "if (item of array)"
There is a proposal I guess for a method, but only for ES7:
It's obvious in hindsight. Wants a @@hasInstance-like protocol, not just
desugaring to `includes` with operands transposed to receiver and argument.
An `of` operator with unstratified symbol-named MOP hook helps various
container-like objects cope with the vagaries of NaNs and indexOf /
includes differences between arrays and strings, and (most winningly)
lines up with for-of, as Ian points out, in a parallel to for-in and `in`.
I'm sure it's worth some debate, perhaps someone will k.o. the idea with
an objection I can't think of, but I like it.
More information about the es-discuss