Re: Proxy-for-array transparency issues

2013-07-31 Thread Tom Van Cutsem
2013/7/31 Allen Wirfs-Brock al...@wirfs-brock.com 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.

Re: Proxy-for-array transparency issues

2013-07-31 Thread Erik Arvidsson
On Jul 31, 2013 6:40 AM, Tom Van Cutsem tomvc...@gmail.com wrote: On the flip side: DOM nodelists, while behaviorally similar to arrays, also don't pass the Array.isArray test. Does this anger developers? Or is this common wisdom and people have learned to live with the differences between

Re: Proxy-for-array transparency issues

2013-07-30 Thread Allen Wirfs-Brock
On Jul 29, 2013, at 7:04 PM, David Bruant wrote: Le 30/07/2013 03:09, Allen Wirfs-Brock a écrit : On Jul 29, 2013, at 5:11 PM, David Bruant wrote: Le 29/07/2013 20:41, Allen Wirfs-Brock a écrit : The legacy [[Class]] internal property conflated these two concepts. Sometimes it was used

Re: Proxy-for-array transparency issues

2013-07-30 Thread David Bruant
2013/7/30 Allen Wirfs-Brock al...@wirfs-brock.com On Jul 29, 2013, at 7:04 PM, David Bruant wrote: Le 30/07/2013 03:09, Allen Wirfs-Brock a écrit : On Jul 29, 2013, at 5:11 PM, David Bruant wrote: Nope. We would have had the same problems if we had kept [[Class]]. In ES=5.1 [[Class]] is

Re: Proxy-for-array transparency issues

2013-07-30 Thread Tom Van Cutsem
tl;dr: I would argue that Array.isArray should return true for proxies-for-arrays. The other built-ins are less crucial and could stay the way they are. Summarizing the previous discussion: - I agree that it is not safe to generalize: a proxy for an X is not in general substitutable for X. - It

Re: Proxy-for-array transparency issues

2013-07-30 Thread André Bargull
/ * ArrayBuffer.isView // yup. The use cases for isView aren't all that clear to me. It could be // expressed a @@isView test if it has important use cases. / I'm not familiar enough with ArrayBuffers to understand the consequences. By analogy with Array.isArray, if a proxy-for-arraybuffer

Re: Proxy-for-array transparency issues

2013-07-30 Thread David Bruant
2013/7/30 Tom Van Cutsem tomvc...@gmail.com tl;dr: I would argue that Array.isArray should return true for proxies-for-arrays. The other built-ins are less crucial and could stay the way they are. What about WeakMaps? Maps? Sets? How is the line drawn between crucial and less crucial? How is

Re: Proxy-for-array transparency issues

2013-07-30 Thread Tom Van Cutsem
2013/7/30 David Bruant bruan...@gmail.com 2013/7/30 Tom Van Cutsem tomvc...@gmail.com tl;dr: I would argue that Array.isArray should return true for proxies-for-arrays. The other built-ins are less crucial and could stay the way they are. What about WeakMaps? Maps? Sets? I meant the

Re: Proxy-for-array transparency issues

2013-07-30 Thread Allen Wirfs-Brock
On Jul 30, 2013, at 1:25 AM, David Bruant wrote: 2013/7/30 Allen Wirfs-Brock al...@wirfs-brock.com On Jul 29, 2013, at 7:04 PM, David Bruant wrote: Le 30/07/2013 03:09, Allen Wirfs-Brock a écrit : On Jul 29, 2013, at 5:11 PM, David Bruant wrote: ... no special this here. I'm just

Re: Proxy-for-array transparency issues

2013-07-30 Thread David Bruant
Le 30/07/2013 18:57, Allen Wirfs-Brock a écrit : So far in ES=6 dealing with such private data slots is something that could be treated in a relatively ad hoc manner within the ES spec. and by implementations. But in ES7 we really want and need user definable per instance private data. The

Re: Proxy-for-array transparency issues

2013-07-30 Thread Allen Wirfs-Brock
On Jul 30, 2013, at 12:40 PM, David Bruant wrote: Le 30/07/2013 18:57, Allen Wirfs-Brock a écrit : ... But it still doesn't work the way you would like for direct call invocation or for things like Array.isArray. The base issue for either of these is that they don't indirect through

Re: Proxy-for-array transparency issues

2013-07-30 Thread Till Schneidereit
On Tue, Jul 30, 2013 at 10:19 PM, Allen Wirfs-Brock al...@wirfs-brock.comwrote: 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:

Re: Proxy-for-array transparency issues

2013-07-30 Thread Allen Wirfs-Brock
On Jul 30, 2013, at 2:21 PM, Till Schneidereit wrote: On Tue, Jul 30, 2013 at 10:19 PM, Allen Wirfs-Brock al...@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

Re: Proxy-for-array transparency issues

2013-07-30 Thread David Bruant
Le 30/07/2013 22:19, Allen Wirfs-Brock a écrit : On Jul 30, 2013, at 12:40 PM, David Bruant wrote: Le 30/07/2013 18:57, Allen Wirfs-Brock a écrit : ... But it still doesn't work the way you would like for direct call invocation or for things like Array.isArray. The base issue for either

Re: Proxy-for-array transparency issues

2013-07-30 Thread Till Schneidereit
On Wed, Jul 31, 2013 at 12:19 AM, Allen Wirfs-Brock al...@wirfs-brock.comwrote: On Jul 30, 2013, at 2:21 PM, Till Schneidereit wrote: On Tue, Jul 30, 2013 at 10:19 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: I was really asking about purpose of application level Array.isArray

Proxy-for-array transparency issues

2013-07-29 Thread Tom Van Cutsem
Hi, Originally, direct proxies were specified such that a direct proxy would inherit the [[Class]] of the target object it wraps. The intent was for e.g. proxies-for-arrays to be recognized properly as arrays. In ES6 the [[Class]] property is gone and the current draft instead uses wording such

Re: Proxy-for-array transparency issues

2013-07-29 Thread Allen Wirfs-Brock
On Jul 29, 2013, at 9:06 AM, Tom Van Cutsem wrote: Hi, Originally, direct proxies were specified such that a direct proxy would inherit the [[Class]] of the target object it wraps. The intent was for e.g. proxies-for-arrays to be recognized properly as arrays. In ES6 the [[Class]]

Re: Proxy-for-array transparency issues

2013-07-29 Thread David Bruant
Le 29/07/2013 20:41, Allen Wirfs-Brock a écrit : The legacy [[Class]] internal property conflated these two concepts. Sometimes it was used for to ensure that a built-in method was operating upon an instance that actually had the internal state or conformed to other implementation level

Re: Proxy-for-array transparency issues

2013-07-29 Thread Brendan Eich
David Bruant wrote: Also, I fail to understand the difference between if O is an exotic X object and if O.[[Class]] === X. +1 What have we gained? /be ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Proxy-for-array transparency issues

2013-07-29 Thread Brandon Benvie
On 7/29/2013 5:14 PM, Brendan Eich wrote: David Bruant wrote: Also, I fail to understand the difference between if O is an exotic X object and if O.[[Class]] === X. +1 What have we gained? It seems to me like duck-typing based on internal properties was basically superseded by @@create

Re: Proxy-for-array transparency issues

2013-07-29 Thread Allen Wirfs-Brock
On Jul 29, 2013, at 5:11 PM, David Bruant wrote: Le 29/07/2013 20:41, Allen Wirfs-Brock a écrit : The legacy [[Class]] internal property conflated these two concepts. Sometimes it was used for to ensure that a built-in method was operating upon an instance that actually had the internal

Re: Proxy-for-array transparency issues

2013-07-29 Thread David Bruant
Le 30/07/2013 03:09, Allen Wirfs-Brock a écrit : On Jul 29, 2013, at 5:11 PM, David Bruant wrote: Le 29/07/2013 20:41, Allen Wirfs-Brock a écrit : The legacy [[Class]] internal property conflated these two concepts. Sometimes it was used for to ensure that a built-in method was operating