RE: Using objects for a mapping argument

From: Jeffrey Yasskin [mailto:jyasskin@google.com] 

> Does this make sense, or should I have my users express these arguments in some other way?

It's hard for me to judge what the best user-facing API is without some sample code, so I'll refrain from commenting on that.

However, the prose to process it is problematic in a number of ways. For example, it checks the public `length` property, and uses `Array.prototype.map.call` directly. (Whose behavior will vary if the user overrides any of: window.Array, Array.prototype, Array.prototype.map, Function.prototype.call.) This doesn't really matter anyway, as sequences are not JavaScript arrays; they are Web IDL data types. They do not have .length properties, and you cannot call map on them. And you shouldn't be using the public, overridable BluetoothUUID.getService method; use the algorithm instead.

> If this makes sense, would you like me to propose some WebIDL operations that would make it easier?

The actual [[OwnPropertyKeys]] steps look pretty reasonable, and yeah, maybe factoring them out into some kind of phrase that lets you extract things in this sort of scenario makes sense. This might tie into the discussions around OpenEndedDictionary?

Received on Sunday, 25 September 2016 14:52:43 UTC