Agreed, we need a[-1] for a[a.length-1] syntactic sugar, or there's no point. The Array slice method, among others, already does sensible and Pythonic processing of negative arguments.

The way to provide syntax for negative indexes (if not Pythonic slicing) is under a new version. But that would complicate the spec, the various implementations, and the migration landscape for old code (did this old code that I did not write, but that I'm paid to port, use anything that evaluated to -1 as an array index?).

And such a strawman lacks a champion to write up the proposal and carry it through prototyping and standardization. I've toyed with slice syntax before, and may again, but I'm not that champion. So this seems unlikely to make it past "straw" state.

/be


On May 12, 2010, at 12:53 PM, Jordan Osete wrote:


De : Dmitry A. Soshnikov <[email protected]>
Envoyé le : Mer 12 mai 2010, 9h 12min 01s

> That's too bad concurrency for alternative and already invented syntactic sugar for that -- a bracket notation used in many languages. I should mention Python again and its very convenient indexing/slicing:
> ...
> So, don't think that JS -- a highly abstracted language, needs this getItem / setItems, even if for less abstracted languages (even for Assembler) there is bracket notation for addressing offset from the base of a structure.

Well, I can agree of that, I would prefer to have that syntactic sugar. This kind of getItem / setItem would have been just temporary solutions for the current implementations until that sugar is ready to be used in a few years, just like filter and map are temporary replacements for array comprehensions.

Jordan


_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to