[Bug 21640] Dictionaries and callbacks should be distinguishable


--- 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