Axel Rauschmayer (2013-07-28T14:38:17.000Z)
Wondering: If most data structures in ES6 use the methods get() and set(), couldn’t we add those to arrays and then simply allow negative indices?

Then we’d be able to do the following:
> let arr = [ 'a', 'b', 'c' ];
> arr.get(-1)
'c'


That’d be kind of like a negative version of Allen’s “Object Model Reformation” proposal:
http://wiki.ecmascript.org/doku.php?id=strawman:object_model_reformation



On Jul 28, 2013, at 14:13 , David Bruant <bruant.d at gmail.com> wrote:

> Hi,
> 
> Asked by Angus Croll [1]. Interestingly, people who answered giving code didn't agree on a method or getter. Hence the need for a standard :-)
> Array.prototype.first could work too.
> 
> David
> 
> [1] https://twitter.com/angustweets/status/359827047117373443
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
> 

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130728/6f1956b4/attachment-0001.html>
domenic at domenicdenicola.com (2014-05-14T17:02:25.412Z)
Wondering: If most data structures in ES6 use the methods get() and set(), couldn’t we add those to arrays and then simply allow negative indices?

Then we’d be able to do the following:

```
> let arr = [ 'a', 'b', 'c' ];
> arr.get(-1)
'c'
```

That’d be kind of like a negative version of Allen’s “Object Model Reformation” proposal:
http://wiki.ecmascript.org/doku.php?id=strawman:object_model_reformation