Till Schneidereit (2013-07-30T23:26:37.000Z)
On Wed, Jul 31, 2013 at 12:19 AM, Allen Wirfs-Brock
<allen at wirfs-brock.com>wrote:

>
> On Jul 30, 2013, at 2:21 PM, Till Schneidereit wrote:
>
> On Tue, Jul 30, 2013 at 10:19 PM, Allen Wirfs-Brock <allen at wirfs-brock.com
> > wrote:
>
>> I was really asking about purpose of application level Array.isArray
>> tests.  What is the application really asking when it uses that test? Is it
>> really asking "array-like"?  What counts as "array-like"?
>>
>
> My guess is: whether the generic Array methods work for this object. Which
> is a sensible thing to want to know, and which, imo, Array.isArray *seems*
> to provide, if you don't know better.
>
>
> In which case, we are talking about bogus tests because that isn't really
> what Array.isArray determines and the generic Array methods will work (to
> some degree or another) on any object.
>

I'm aware. And I don't have evidence for tests like that existing. Maybe
somebody looking to verify that some object fulfills some kind of contract
would know better than naively using isArray without knowing what it
actually does.


>
> We could define a new predicate Array.isArrayLike with a proxy friendly
> extensions mechanism (@@isArrayLike).  It wouldn't be the same test as
> Array.isArray and the result would be more a statement of intent than an
> absolute guarantee.
>
> Would anybody use it? Would it's existence be enough to eliminate the
> Array.isArray/proxy concern?
>

It probably would, if the concern is a valid one at all. Somebody naive
enough to use isArray would probably still stumble over the existence of an
isArrayLike.

It's probably just not worth it, though.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130731/0be1e191/attachment.html>
domenic at domenicdenicola.com (2013-08-04T22:37:40.741Z)
On Wed, Jul 31, 2013 at 12:19 AM, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote:

> My guess is: whether the generic Array methods work for this object. Which
> is a sensible thing to want to know, and which, imo, Array.isArray *seems*
> to provide, if you don't know better.
>
>
> In which case, we are talking about bogus tests because that isn't really
> what Array.isArray determines and the generic Array methods will work (to
> some degree or another) on any object.

I'm aware. And I don't have evidence for tests like that existing. Maybe
somebody looking to verify that some object fulfills some kind of contract
would know better than naively using isArray without knowing what it
actually does.


> We could define a new predicate Array.isArrayLike with a proxy friendly
> extensions mechanism (@@isArrayLike).  It wouldn't be the same test as
> Array.isArray and the result would be more a statement of intent than an
> absolute guarantee.
>
> Would anybody use it? Would it's existence be enough to eliminate the
> Array.isArray/proxy concern?

It probably would, if the concern is a valid one at all. Somebody naive
enough to use isArray would probably still stumble over the existence of an
isArrayLike.

It's probably just not worth it, though.