- From: Boris Zbarsky <bzbarsky@mit.edu>
- Date: Mon, 26 Sep 2016 14:41:01 -0400
- To: public-script-coord@w3.org
On 9/23/16 9:23 PM, Jeffrey Yasskin wrote: > In https://api.csswg.org/bikeshed/?url=https://raw.githubusercontent.com/jyasskin/web-bluetooth-1/masked-data-prefixes/index.bs#device-discovery > defines some arguments to a function in which I want users to express > a map from integers or strings to a dictionary. One of the arguments > will look like {0x004C: {dataPrefix: [0x02, 0x15]}}, while the other > could be {0xFEAA: {dataPrefix: [0x10]}, "battery_service": {}}. For your case, where each value has the same "shape" (in that they are all converted to the same dictionary), this is basically similar to the OpenEndedDictionary proposal, right? > This is processed at > https://api.csswg.org/bikeshed/?url=https://raw.githubusercontent.com/jyasskin/web-bluetooth-1/masked-data-prefixes/index.bs#ref-for-dom-bluetoothlescanfilterinit-manufacturerdata-5 > using explicit calls to `.[[OwnPropertyKeys]]()` and some other > ECMAScript operations. Right, so compared to the other uses of OpenEndedDictionary this has the following additional wrinkles: 1) Some constraints on the "keys" of the dictionary. This is fine; other consumers want this too; it's simple enough to express in prose. 2) The way you set up properties on canonicalizedFilter.manufacturerData is using [[Set]] instead of [[DefineOwnProperty]]. You should probably use the latter. 3) Since you're going around creating ES objects, there's the usual question of whether you want to use the global of the callee function or the global of the "this" value to do that. > Does this make sense, or should I have my users express these > arguments in some other way? In general, this makes sense. We should really get OpenEndedDictionary specced.... -Boris
Received on Monday, 26 September 2016 18:41:34 UTC