Rest parameter syntax

Felix Böhm esdiscuss at
Tue Jun 12 07:38:48 PDT 2012

Per definition, rest parameters always need to be at the end of a
FormalParameterList. I was wondering if this limitation could be liftet.

Use-case: Most SQL libraries for node support passing query arguments to
the query function (so SQL injections are avoided). The usual syntax
* FROM t WHERE foo=? AND cbar=?", "bar", "cfoo", function(err, row){…});

The number of arguments passed after the query depends on the number of
question marks inside the query. It would be nice when an implementation
could simply write = function(query, ...params, cb){…} and avoid
using the arguments object or Array#poping the last element of params.

This change would require two additions: Every Identifier past rest can't
be another rest parameter or have a default value specified.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list