W3C home > Mailing lists > Public > public-script-coord@w3.org > January to March 2012

Re: Omissions in IDL sequence and IDL array conversion to ES array

From: Cameron McCormack <cam@mcc.id.au>
Date: Wed, 04 Jan 2012 13:10:00 +1100
Message-ID: <4F03B4F8.8050709@mcc.id.au>
To: James Graham <jgraham@opera.com>
CC: public-script-coord@w3.org, joaoe@opera.com
João Eiras:
>> I have some questions about the following two sections
>> * http://dev.w3.org/2006/webapi/WebIDL/#es-sequence
>> * http://dev.w3.org/2006/webapi/WebIDL/#es-array
>> For the sake of the examples, exampleFunction is a function which
>> converts the first argument to an ES Array.

James Graham:
> My reading of the specification is that your examples would throw
> TypeError because given an operation like
> void foo(array);
> the overload resolution algorithm will return no matches unless the
> passed type is "is a platform array object, a native Array object, or a
> platform object that supports indexed properties", which I think your
> examples are not.

That's correct.

When assigning to IDL attributes, however, we don't run the overload 
resolution algorithm that would weed out certain kinds of values.  That 
means that assigning to an attribute of type T[] would accept some 
values that calling an operation with an argument of type T[] wouldn't. 
  That doesn't seem useful, so I will try to ensure that all of the 
"convert ES to IDL value" algorithms accept only the kinds of values 
that you could get out of the overload resolution algorithm anyway.

Filed https://www.w3.org/Bugs/Public/show_bug.cgi?id=15411.

> However this depends critically on an interpretation of "platform
> object" that means a DOM object is a "platform object" whilst an object
> like {0:1, 1:2, length:2} is not. I can't work out what the definition
> of "platform object" in the spec is supposed to imply. In particular I
> can't tell how one can determine mechanically if a given object is a
> platform object or not. Could the spec be clarified here please?

The current strange definition for platform objects versus user objects 
was because it used to be possible for [Callback]-annotated IDL 
interfaces to be implemented by DOM objects as well as by native objects 
not provided by the DOM.  Because the DOM implementation might well be 
written in JavaScript, using an object's native-ness (or conversely its 
host-ness) to determine whether it is a platform object or user object 
is not quite right.

However, since the changes that removed [Callback] and added the concept 
of callback interfaces, we no longer have the possibility that both DOM 
objects and author objects can implement an interface.  Callback 
interfaces can only be implemented by user objects and non-callback 
interfaces can only be implemented by platform objects.  That should let 
us simplify the definition of platform object and user object -- 
platform objects are just those that implement a given IDL interface, now.

Filed https://www.w3.org/Bugs/Public/show_bug.cgi?id=15412.
Received on Wednesday, 4 January 2012 02:13:00 UTC

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