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

On Thu, 05 Jan 2012 01:10:30 -0000, Cameron McCormack <cam@mcc.id.au>  
wrote:

> João Eiras:
>> I seriously suggest that objects with a length and numbered properties
>> (like "{length:1,0:1}") be supported though. The only practical
>> difference with Array is that the object does not inherit the Array
>> prototype, and hence does not support its methods, but that is not
>> necessary for the host's function implementation.
>>
>> ecmascript is flexible enough to allow other object types to be used as
>> arrays
>> var x = {};
>> [].push.call(x, 1);
>> [].push.call(x, 2);
>> // x == {length: 2, 0: 1, 1: 2}
>>
>> jQuery objects are not arrays, yet they have length and numbered
>> properties.
>
> This used to be allowed, for the reasons you state.  I mentioned in  
> http://www.w3.org/mid/4EEFE632.9010506@mcc.id.au that disallowing it  
> allows overloading on sequences and dictionaries, and was generally  
> helpful in simplifying the overload resolution algorithm.
>

Is it really an issue ? Are there overloaded APIs which support both  
dictionaries and arrays/sequences ? I don't recall any at the moment. Or  
if there was ambiguity, renaming one of the overloads would be an option.

Received on Thursday, 5 January 2012 02:58:27 UTC