Omissions in IDL sequence and IDL array conversion to ES array


I have some questions about the following two sections

For the sake of the examples, exampleFunction is a function which converts  
the first argument to an ES Array.

First, both mention to [[Get]] the property of name length from the object  
and call ToUInt32 on the value. What happens if the object does not have a  
length property? Should a TypeError be thrown, or an array of length 0  

What happens is a function object is passed ?

# var f = new Function("arg1", "arg2", "code");
# exampleFunction(f);

Function objects have immutable lengths, but by default no indexed  
properties. Would it make sense for native function objects to throw a  
TypeError? Passing a function as an array would perhaps most likely be a  
programming error anyway.

According to the spec a String object would be converted into an array, by  
separating each character into each array position, because Strings by  
default have a length property, just like atomic strings, and indexed  
properties. However atomic strings aren't objects, hence the algorithm  
would fail.

# exampleFunction(new String("abc"))
would convert the argument to
# ["a","b","c"]

Is this expected? It does seem completely overkill though given that  
strings internally are not really represented as an array of individual  
characters. It might be useful but would most likely be a programming  

Some cases:
# exampleFunction([new String("arg")]) // passes ["abc"]
# exampleFunction(new String("arg")) // passes [a,b,c]
# exampleFunction("arg") // throws TypeError

All three produce very different results.

Thank you.

Received on Tuesday, 3 January 2012 13:15:08 UTC