A slightly less ambitious suggestion:
consider f() as syntax for the implicit arguments array
(which, as of ES6, can be considered deprecated), then
make the parens in this syntax optional
In other words, you could write
f 1 // single parameter
f(1,2) // single parameter, implicit arguments pseudo-array
f [1,2] // single parameter, explicit array
Things get more interesting when you consider currying (functions
returning functions):
f(1)(2) // conventional, implicit arguments pseudo-arrays
f 1 2 // paren-free, single parameters, no arrays
For your nested call example, you'd have the choice between
foo(1, 2, bar("a", "b")) //uncurried, implicit pseudo-arrays
foo[1, 2, bar["a", "b"]] // uncurried, explicit arrays
foo 1 2 (bar "a" "b") // curried, single parameters
In the latter variant, () are used for grouping, consistent with their
use in the rest of the language.
Nice as this would be, I don't know whether this can be fitted into
ES grammar and ASI... (probably not?).
Claus
PS. could es-discuss-owner please check their mailbox
(and update the mailing list info page)?
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss