W3C home > Mailing lists > Public > public-script-coord@w3.org > October to December 2014

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

From: <bugzilla@jessica.w3.org>
Date: Fri, 03 Oct 2014 17:44:17 +0000
To: public-script-coord@w3.org
Message-ID: <bug-26183-3890-M3I5DsnYGp@http.www.w3.org/Bugs/Public/>
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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:23 UTC