[Bug 26183] make it easier to define an iterator on an interface that iterates over a set of values

https://www.w3.org/Bugs/Public/show_bug.cgi?id=26183

--- Comment #34 from Domenic Denicola <domenic@domenicdenicola.com> ---
Reviewing...

The setlike looks a bit strange, since it allows two types. It should only
allow one type, I think. ES (for some reason) has keys() -> Iterable<T>,
values() -> Iterable<T>, and entries() -> Iterable<[T, T]>, but it's the same T
always.

In the @@iterator definitions, you use CreateMapIterator and friends directly
on the objects, but the objects do not have [[MapData]] internal slots, so this
will immediately fail. I don't know how to solve this though, since if you put
[[MapData]] on the object then you can use Map.prototype.set.call(obj,
"bypassed your typechecking haha"). Maybe you could forward to
[[BackingMap]].@@iterator? You have to be careful not to allow anyone access to
[[BackingMap]] somehow.

It is probably implicit, but I don't see anywhere that explicitly does type
conversion on arguments passed to the forwarding functions. Am I correct in
assuming this happens implicitly because they are WebIDL methods instead of JS
methods? Or is this missing?

Overall this looks pretty nice. Very batteries-included.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Received on Friday, 3 October 2014 17:44:19 UTC