W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2013

[Bug 21640] Dictionaries and callbacks should be distinguishable

From: <bugzilla@jessica.w3.org>
Date: Fri, 12 Apr 2013 16:30:26 +0000
To: public-script-coord@w3.org
Message-ID: <bug-21640-3890-BEKZ2de8ok@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=21640

--- Comment #12 from Markus Lanthaler <mark_lanthaler@gmx.net> ---
(In reply to comment #10)
> (In reply to comment #9)
> > Why is object or object[] not valid WebIDL? The only restriction on arrays
> > I've found in the WebIDL spec is the following: "The element type of an
> > array MUST NOT be a sequence or dictionary type." Is it because object and
> > object[] are not distinguishable? What could we do about that?
> 
> You can't do anything about it.  That's the whole point of "not
> distinguishable" - you can't distinguish them in a reliable way.  (Node and
> other JS libraries often use some arbitrary form of duck-typing to
> accomplish this, but that doesn't work at large.)

Are saying that an implementation of the API wouldn't be able to find out what
has been passed? What about ECMAScript 5's isArray function?

This methods are used to transform JSON-LD documents which can be objects or
arrays as at the top-level (just as JSON according RFC4627). We use the (object
or object[]) union type to describe that in WebIDL. What other type should we
use instead? Just object since an array is also an object? I fear that would
confuse most readers.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
Received on Friday, 12 April 2013 16:30:33 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:37:48 UTC