[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 #36 from Cameron McCormack <cam@mcc.id.au> ---
(In reply to Domenic Denicola from comment #34)
> 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.

Yeah, copy-paste error in the green block there and in the following paragraph.
 (Which is odd because I remember taking care of that; must have lost some
edits while git stashing.)  Fixed:
https://github.com/heycam/webidl/commit/7ceed8553feeab1a3ffbc0e138c68f0e795b99d4

> 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.

Yes my intention was to grab the [[BackingMap]] and call CreateMapIterator with
that but I guess I forgot here.  Fixed:
https://github.com/heycam/webidl/commit/4de741337480e65c5b36f5bf667dbae421c3f7ac

> 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?

No, it's missing.  Added (at the expense of expanding this section out some
more):
https://github.com/heycam/webidl/commit/06828878e769bbbe5e20d5f9a55ae0bb8e093a22

> Overall this looks pretty nice. Very batteries-included.

Thanks!

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

Received on Saturday, 4 October 2014 12:27:16 UTC