- From: <bugzilla@jessica.w3.org>
- Date: Wed, 03 Apr 2013 19:10:59 +0000
- To: public-webapps-bugzilla@w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=21555
--- Comment #11 from Joshua Bell <jsbell@chromium.org> ---
(In reply to comment #10)
> Let me just ask for a clarification. When you say "a variable length
> DOMString array" does that mean you are fine with it being a "platform array
> object", i.e. a host object that behaves a bit like a native Array, but not
> exactly? To be clear, that's what "DOMString[]" means.
I think we'd prefer to just return a native Array. Requiring a platform array
object puts an additional burden on implementers.
> Web IDL specifically disallows sequence<T>, which means "a native Array
> object whose values are copied out and converted to type T when you pass it
> in to a method, and creates a new Array object each time when returned from
> a method", from being used as the type of an IDL attribute. This is exactly
> to avoid the issue Boris mentions in comment 1, where you probably don't
> want to return a newly created object every time you get the attribute.
Agreed, but to be clear this is not a method that will be called very often.
It's used for introspecting an immutable property of an object. i.e. given:
var store = db.transaction('store').objectStore('store');
The value of store.keyPath can never change for the lifetime of the store
object.
> My feeling is that using DOMString[] is the better option, since it is less
> confusing than returning an Array object that could be modified but which
> has no effect. You could then say in prose that the same object is always
> returned from this IDL attribute (you would have the object update itself to
> reflect the curreny key path), and you would also declare the object
> returned as "read only"
Since it's immutable, we don't need to worry about updates. I believe that
using DOMString[] in the IDL would be satisfied by an implementation that
returned a DOMStringList which is what Chrome does already (although it hands
out a fresh copy on each access).
But that puts a burden on Gecko and ISTM that having a way to say "just returns
a native array" without "any" would be ideal. The spec already needs to deal
with the "same value each time" bit in prose for cursor.key/cursor.value.
--
You are receiving this mail because:
You are the QA Contact for the bug.
Received on Wednesday, 3 April 2013 19:11:02 UTC