W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2016

RE: Using objects for a mapping argument

From: Domenic Denicola <d@domenic.me>
Date: Sun, 25 Sep 2016 14:52:14 +0000
To: Jeffrey Yasskin <jyasskin@google.com>, public-script-coord <public-script-coord@w3.org>
Message-ID: <CY1PR0501MB1369B0D34EEC48B7549B90D9DFCA0@CY1PR0501MB1369.namprd05.prod.outlook.com>
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

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