Well-Known Symbols: Array item getter/setter

2015-04-09 Thread Kos Ddsky
( note: you can view this message as a gist @ https://gist.github.com/kosich/375da99403c76bc75bbd ) Currently we can imitate Arrays only with objects, where we would refer to a value at some position via referring to objects property ( with integer index being converted to a string ) ```js var

Re: Well-Known Symbols: Array item getter/setter

2015-04-09 Thread Axel Rauschmayer
Proxies should be enough for this. Is there any reason not to use them? On 09 Apr 2015, at 20:31, Kos Ddsky kos...@gmail.com wrote: ( note: you can view this message as a gist @ https://gist.github.com/kosich/375da99403c76bc75bbd https://gist.github.com/kosich/375da99403c76bc75bbd )

Re: Well-Known Symbols: Array item getter/setter

2015-04-09 Thread Allen Wirfs-Brock
On Apr 9, 2015, at 2:37 PM, Jordan Harband ljh...@gmail.com wrote: One advantage of this approach is that more spec magic can be implemented in terms of the language - it would also make subclassed arrays more versatile instead of having to always be a Proxy. see

Re: Well-Known Symbols: Array item getter/setter

2015-04-09 Thread Jordan Harband
One advantage of this approach is that more spec magic can be implemented in terms of the language - it would also make subclassed arrays more versatile instead of having to always be a Proxy. On Thu, Apr 9, 2015 at 11:35 AM, Axel Rauschmayer a...@rauschma.de wrote: Proxies should be enough for

Re: Well-Known Symbols: Array item getter/setter

2015-04-09 Thread Kos Ddsky
1. one will have to provide access to all `Array.prototype.methods` 2. proxies will be slower 3. bad readability ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Well-Known Symbols: Array item getter/setter

2015-04-09 Thread Axel Rauschmayer
An alternative that was discussed at one point was to invert this idea: * Arrays get the methods that Maps already have: `get(index)` and `set(index, value)`. Advantage: one could support negative indices. That is, the following two expressions would be equivalent. ```js arr.get(-1)