Re: Distinguishing objects and arrays?

On 9/17/11 3:04 PM, Mark S. Miller wrote:
>
>
> On Sat, Sep 17, 2011 at 2:57 PM, Anne van Kesteren <annevk@opera.com 
> <mailto:annevk@opera.com>> wrote:
>
>
>     The problem is however that arrays and objects are not really
>     distinguishable unless you do "evil things".
>
>     Anyone with ideas?
>
>
> Array.isArray <http://es5.github.com/#x15.4.3.2> is not evil.
>
> If for some reason that is unsuitable, there are some ideas at 
> <http://wiki.ecmascript.org/doku.php?id=conventions:isarraylike>. 
> Though like I say at the note at the top, I no longer believe it is 
> practical to attempt to standardize an isArrayLine based on current 
> practice.
>
While I agree that Array.isArray() is non-evil, I suspect that Anne's 
difficulties have to do with the specification of the create() method in 
WebIDL and not with its practical implementation...

Unfortunately I've never worked my way through the overload resolution 
section of WebIDL, so I don't have anything constructive to add.

     David

Received on Wednesday, 21 September 2011 04:59:31 UTC