On Tue, Jun 12, 2012 at 11:26 AM, Rick Waldron <[email protected]>wrote:
> > > On Tue, Jun 12, 2012 at 10:38 AM, Felix Böhm <[email protected]> wrote: > >> Per definition, rest parameters always need to be at the end of a >> FormalParameterList. I was wondering if this limitation could be liftet. >> > > Consider: > > > function foo( a, b, ...others, c ) { > return [ a, b, others, c ]; > } > > > foo( 1, 2, 3, 4, 5, 6, 7, 8, 9 ); > > > a b others > [ 1, 2, [ 3, 4, 5, 6, 7, 8, 9 ] ] > > > How do you resolve where to stop claiming arguments as items in the rest > param "others"? > Well, I mean, technically speaking its no different than a very simple regex. > /(.)(.)(.*)(.)/.exec("123456789"); ["123456789", "1", "2", "345678", "9"] > /(.)(.)(.*)(.)/.exec("123"); ["123", "1", "2", "", "3"] >From that perspective, it seems pretty deterministic and easy to explain. There's probably a reason I'm not thinking of, though. - Russ Rick > > > > > > > > > > _______________________________________________ > 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

