Brendan Eich (2015-03-30T20:52:07.000Z)
forbes at lindesay.co.uk (2015-03-31T23:37:47.906Z)
> Frankie Bagnardi wrote: > > Would `Object.create(null, {[Symbol.iterator]: value: ...})` work as > it does in `for..of`? No, as with `instanceof` and `@@hasInstance` in general, you wouldn't get membership test for free. But unlike `instanceof`, you wouldn't get common case behavior for free either, so that's the downside. You'd have to provide a value such as `Array#includes` for the property named by `Symbol.hasElement` (or whatever the best name analogous to `@@hasInstance` is). > It seems like the main problem would be infinite sequences. That means > either infinite loops (ugh), or the language/user setting an arbitrary > number of max values to check (ew). > Neither. > If I do have an arbitrary iterable, I need to easily create something > I can pass to `for..of` with `if (x of fn(xs))` where fn is provided by > ecmascript. You'd need to implement a separate MOP hook, let's call it `@@hasElement` for now.