rest parameters
Isiah Meadows
isiahmeadows at gmail.com
Mon Oct 5 10:44:12 UTC 2015
I'm not trying to restart debate on this, but I do know CoffeeScript
allows it. It does a greedy grab, but it only allows a single spread
element, and default parameters take full precedence over rest
parameters in what is taken. [1]
As for optimization, that's probably the bigger issue. It's not very
easily optimizable in my experience, even statically (much less at
runtime). The code I usually have to write in those cases gets ugly in
a hurry, and it's not a common use case. Example (it's LiveScript,
which also has this, equivalent (not compiled) ES5, and equivalent
ES6): [2]. Obviously, in that example, the ES5 version is a little out
of hand, using array hacks in the name of speed, but the ES6 version
isn't exactly pretty, and that isn't even as focused on engine speed.
If you want to optimize this, good luck. The ES5 version isn't that
far off of what low-level hacks would be needed to make it efficient.
Note that LiveScript does exactly the same thing as CoffeeScript in this case.
[1] http://coffeescript.org/#try:f%20%3D%20%28a%2C%20b...%2C%20c%29%20-%3E%0A%20%20alert%20[a%2C%20b%2C%20c].join%20%27%20%27%0A%0Af%20%27Hello%27%2C%20%27my%27%2C%20%27world%27
[2] https://gist.github.com/impinball/0ea14936a1680065a3a3
On Sat, Oct 3, 2015 at 3:50 AM, Michaël Rouges <michael.rouges at gmail.com> wrote:
> I understand better now ... Thanks a lot again...
>
> And, sorry, Tab... to not deal with you on already debated topics.
>
> I hope the following will not be one.
>
>
> Michaël Rouges - https://github.com/Lcfvs - @Lcfvs
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
--
Isiah Meadows
More information about the es-discuss
mailing list