On 12.11.2010 1:17, Allen Wirfs-Brock wrote:
-Original Message-
From: Dmitry A. Soshnikov [mailto:dmitry.soshni...@gmail.com]
...
Yeah, it's possible to make this thing generic, though maybe also good only for
arrays. Need to more discuss, think.
There isn't actually all that much
On 12.11.2010 1:21, Allen Wirfs-Brock wrote:
-Original Message-
From: Peter van der Zee [mailto:e...@qfox.nl]
...
I guess I would like -n to map to length-n, but I'm not sure whether it's worth
the
cost described above. After all, it's just sugar.
Like Oliver also said.
Like
On 12.11.2010 2:25, David Herman wrote:
If harmony would introduce this syntax guarded under a new script type, there
would at least be no danger of breaking the web (existing scripts).
That sounds like an interop nightmare -- you're talking about forking the Array
type between language
2010/11/12 Dmitry A. Soshnikov dmitry.soshni...@gmail.com:
What do you suggest?
I suggest you monkey patch a get method on the Array prototype and
forget trying to get the language semantics changed. The people who
implement the language have made their opinions clear and as of this
post that
On 12.11.2010 2:40, Brendan Eich wrote:
I agree with Dave, Allen, and Oliver
That's OK.
I consider several variants also. As Allen mentioned, if it will be a
generic thing, then `foo[-n]` may break an old code (and then we need
another syntax e.g. a[* - 1] -- if need at all then!). OTOH, if
On 12.11.2010 12:01, Erik Corry wrote:
2010/11/12 Dmitry A. Soshnikovdmitry.soshni...@gmail.com:
What do you suggest?
I suggest you monkey patch a get method on the Array prototype and
forget trying to get the language semantics changed. The people who
implement the language have made their
On Nov 12, 2010, at 1:01 AM, Dmitry A. Soshnikov wrote:
I consider several variants also. As Allen mentioned, if it will be a generic
thing, then `foo[-n]` may break an old code (and then we need another syntax
e.g. a[* - 1] -- if need at all then!). OTOH, if only for arrays -- I don't
see
Brendan, thanks for the analysis and tests, possibly it's useful. Also,
I think that a proposal can look more like a proposal (and not like I'm
very want to include something into the language, and other members
resist it), I'm not sure we need to prove something in this case. If
everybody on
On 13.11.2010 0:25, Dmitry A. Soshnikov wrote:
unable to slice:
a.slice(-2, -1); // []
Sorry, typo; meant a.slice(-1, -1); []
Dmitry.
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss
the D language handles this by having the names '$' and 'length' be the
length of the array, within the scope of a [] subscript, so you can say
something like a[$-1]. '$' is already too widely used in js, but maybe
something like '_' would work. say, if there's no declaration of _ in
scope,
On 13.11.2010 0:52, felix wrote:
the D language handles this by having the names '$' and 'length' be
the length of the array, within the scope of a [] subscript, so you
can say something like a[$-1]. '$' is already too widely used in js,
but maybe something like '_' would work. say, if
I would have liked negative indexes for bracket-indexing from the end, and I
suspect others who knew in their bones that it's too incompatible of a change
would too -- we just knew it was not going to be a non-breaking change.
It's very hard to change subtle features that the Web comes to
On 11.11.2010 13:24, Dmitry A. Soshnikov wrote:
There was previous indirect mention, were Brendan agreed that Harmony
needs such a semantics for arrays
Sorry, forgot the link
https://mail.mozilla.org/pipermail/es-discuss/2010-May/05.html
On 11.11.2010 13:24, Dmitry A. Soshnikov wrote:
Toughs?
Funny typo :D Sorry.
Thoughts?
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss
Actually, I'm still not sure myself whether I want this semantics in JS
for arrays. I remember one case (some simple math task) when I was
needed a[-1] and was glad that JS supports it -- I used `for (var i =
-2; i 10; i++) a[i]`, and it was very elegant decision at that moment.
There is
On Nov 11, 2010, at 11:30 AM, Dmitry A. Soshnikov wrote:
OTOH, negative indices, are even not array indices. I.e.
var a = [1,2];
a[-1] = 0;
print(a); // 1,2
print(a.length); // 2
From this viewpoint -- for what are they? Seems again, `-n` notations for
arrays and strings is useful as
On 11 Nov 2010, at 19:30, Dmitry A. Soshnikov wrote:
OTOH, negative indices, are even not array indices. I.e.
var a = [1,2];
a[-1] = 0;
print(a); // 1,2
print(a.length); // 2
From this viewpoint -- for what are they? Seems again, `-n` notations for
arrays and strings is useful as a
On 11.11.2010 22:39, Ash Berlin wrote:
On 11 Nov 2010, at 19:30, Dmitry A. Soshnikov wrote:
OTOH, negative indices, are even not array indices. I.e.
var a = [1,2];
a[-1] = 0;
print(a); // 1,2
print(a.length); // 2
From this viewpoint -- for what are they? Seems again, `-n` notations for
On 11.11.2010 22:39, Oliver Hunt wrote:
On Nov 11, 2010, at 11:30 AM, Dmitry A. Soshnikov wrote:
OTOH, negative indices, are even not array indices. I.e.
var a = [1,2];
a[-1] = 0;
print(a); // 1,2
print(a.length); // 2
From this viewpoint -- for what are they? Seems again, `-n` notations
From: es-discuss-boun...@mozilla.org [mailto:es-discuss-boun...@mozilla.org] On
Behalf Of Dmitry A. Soshnikov
...
Yes, I mentioned it myself several times (in articles and including several
topics in es-discuss). Yes, Python distinguish. Ruby too. But from your
position, ES already has some
On 12.11.2010 0:07, Allen Wirfs-Brock wrote:
From: es-discuss-boun...@mozilla.org [mailto:es-discuss-boun...@mozilla.org] On
Behalf Of Dmitry A. Soshnikov
...
Yes, I mentioned it myself several times (in articles and including several topics in
es-discuss). Yes, Python distinguish. Ruby too.
If harmony would introduce this syntax guarded under a new script type, there
would at least be no danger of breaking the web (existing scripts).
However, negative array indexes might cause confusion when doing so
implicitly. If you asume array indexes are just properties it'll be hard to
So, do I understand correctly that you are against this feature and don't
like it? (Just another question -- are you aware that it used in Python,
Ruby, Perl, Coffee, other langs?)
The fact that other languages have a feature is not relevant, the problem is
the drastic change to semantics
On 12.11.2010 0:42, Peter van der Zee wrote:
If harmony would introduce this syntax guarded under a new script type, there
would at least be no danger of breaking the web (existing scripts).
I don't think it means that using script type=harmony we may do
everything (i.e. completely different
On 12.11.2010 0:47, Oliver Hunt wrote:
So, do I understand correctly that you are against this feature and don't like
it? (Just another question -- are you aware that it used in Python, Ruby, Perl,
Coffee, other langs?)
The fact that other languages have a feature is not relevant, the problem
-Original Message-
From: Dmitry A. Soshnikov [mailto:dmitry.soshni...@gmail.com]
...
Yeah, it's possible to make this thing generic, though maybe also good only
for
arrays. Need to more discuss, think.
There isn't actually all that much difference between array instances and
-Original Message-
From: Peter van der Zee [mailto:e...@qfox.nl]
...
I guess I would like -n to map to length-n, but I'm not sure whether it's
worth the
cost described above. After all, it's just sugar.
Like Oliver also said. This isn't just sugar, it is a deep semantic change to
If harmony would introduce this syntax guarded under a new script type,
there
would at least be no danger of breaking the web (existing scripts).
That sounds like an interop nightmare -- you're talking about forking the Array
type between language versions. Keep in mind that non-Harmony and
I agree with Dave, Allen, and Oliver that we should not just change indexing
under Harmony script-type opt-in.
Note also that Python, at least, has a more elaborate system of slicing that
has evolved over the years. I added slice in the Netscape 4 era, which made it
into ES3 and has the
29 matches
Mail list logo