On 2009-12-15, at 13:59, Mike Samuel wrote: > 2009/12/15 P T Withington <p...@pobox.com>: >> On 2009-12-08, at 13:10, Mike Samuel wrote: >> >>> All true. And yet it is not uncommon. See the bottom of this email >>> for a quick survey of a number of libraries' uses of the array-like >>> concept. >> >> FWIW, Here is the (separately/simultaneously invented) definition from >> OpenLaszlo: >> >> function isArrayLike (obj:*):Boolean { >> if (obj && ((obj is Array) || (obj['length'] != (void 0)))) { > > Please excuse my ignorance, but is "is" equivalent to "instanceof" and > is the use of both obj['length'] and obj.length significant?
As Brendan surmised, this is OpenLaszlo's variant on Javascript, inspired by both ES4 and AS3 (which is probably why it is not found by code search). 'is' is equivalent to 'instanceof' (but also operates on interfaces and mixins). obj['length'] is an idiom (used by our variant and AS3) to silence warnings (in debug mode) for referencing a non-existent property. _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss