On Aug 16, 2007, at 10:42 AM, Lars T Hansen wrote: > On 8/16/07, Stefan Gössner <[EMAIL PROTECTED]> wrote: >> Hello, >> here are my first questions after following the list quite a while. >> >> 1. I really like the array slice syntax [start:end:step] described in >> http://developer.mozilla.org/es4/proposals/slice_syntax.html >> >> The description seems to miss the case, where 'start' is greater >> than 'end'. >> >> a[5:2] >> >> Will >> (a) 'step' be implicitely set to -1 ? >> (b) an empty array come as result ? >> (c) an error occur ? > > The description seems to be clear here, the result should be an > empty array.
Same as for Python: >>> s = [1,2,3] >>> s[2:1] [] > >> 2. The descendant operator '..' is mentioned only in the tutorial >> introduction. >> http://developer.mozilla.org/es4/spec/ >> chapter_1_tutorial_introduction.html >> I could not find it mentioned elsewhere. >> >> Is it also considered to work with array notation as in: >> >> y..[0] // access the first element of all arrays of 'y' and it's >> descendants. > > I don't think so. The descendant operator is for E4X (ECMAScript for > XML, ECMA-357) and has not been discussed in other contexts. E4X is > not included in ECMAScript 4 at this stage. We are reserving E4X syntax but not requiring it to be supported. The .. operator bugs me because it implicitly quotes its right operand (as . does), so you could not use it as Perl and other languages do for range operator. If it were a dyadic operator that did not quote either operand, than it could be overridden by the operators proposal (or an operators proposal, at any rate ;-) and made to work for range (integer literal or value on left) as well as for E4X (XML on left). Generalizing query, matching, and filtering from E4X to the whole language, cleaning up the "un-JavaScript-y" aspects of E4X, making use of practical research such as JMatch [1], all will have to wait for a future Edition. But we certainly can discuss ideas here. Please feel free to do so. /be [1] http://www.cs.cornell.edu/Projects/jmatch/ _______________________________________________ Es4-discuss mailing list Es4-discuss@mozilla.org https://mail.mozilla.org/listinfo/es4-discuss