[Bug 16767] Allow user objects for Array[] types

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

--- Comment #5 from Cameron McCormack <cam@mcc.id.au> 2012-06-20 03:21:21 UTC ---
Overloading between array/sequence types and dictionary types is indeed why {
length: 0 } is always treated as a dictionary.  The use case I had for this was
Anne's proposed DOM manipulation methods, which would have had such an
overloading, but I think that API never eventuated.  So right now there is no
need for overloading like this.

I think our options are:

1. Revert arrays/sequences to being indistinguishable from
   dictionary types, thereby disallowing overloading on these types, and
   allowing JS Objects to be converted to arrays/sequences.

2. Keep the two types distinguishable, but all JS Arrays and Objects to be
   used for both, and always prefer to convert to a dictionary rather than an
   array/sequence.  This wouldn't allow overloading to do anything useful, but
   it would allow a JS Object to be converted to an array/sequence when it's no
   overloaded with a dictionary type.

3. Keep the two types distinguishable, but treat all JS objects with a "length"
   property as an array/sequence, and all others as dictionaries.

4. Do nothing.

I used to dislike option 3 because I didn't want the overload resolution
algorithm to poke into the value of an object in order to disambiguate the call
(currently it only looks at the type of values), but I could live it with
actually.

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

Received on Wednesday, 20 June 2012 03:21:24 UTC