* Name-wise, is `has` a possibility? It feels more intuitive and I don’t think the duality with `in` matters (given that `for-in` will probably rarely be used in the future, due to `for-of` and `Map`).
* Will it ever be possible to define arbitrary infix operators? If yes, should this operator wait until that feature is available? > On 30 Mar 2015, at 07:20, Brendan Eich <bren...@mozilla.org> wrote: > > From https://plus.google.com/+IanBicking/posts/PbXDtNF9Gg6: > > """ > Ian Bicking > Shared publicly - Mar 24, 2015 > #Array > > 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: > https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes > """ > > 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. > > /be -- Dr. Axel Rauschmayer a...@rauschma.de rauschma.de
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss