Named Paramters
Benjamin Gruenbaum
benjamingr at gmail.com
Mon Jul 13 12:54:56 UTC 2015
If we _wanted_ to add named parameters, we would _probably_ have a
_different_ name for the named parameter inside the function and outside
the function.
```js
function foo(x as y){
}
foo(y = 5);
```
Or something like that. That said, I'm not convinced we _need_ named
parameters, that they justify the additional cost or the overhead, that
current solutions like destructing aren't enough and so on. Even if we all
agreed that we want named parameters, and we agreed in general lines how it
should be done, and we convinced the TC, there would still be a lot of work
to actually "decide' they should make it to ES.
So I suggest we close this thread and anyone who feel strongly about
including named parameters should work on a concrete proposal :)
Cheers,
Benjamin
On Mon, Jul 13, 2015 at 3:50 PM, Michał Wadas <michalwadas at gmail.com> wrote:
> In fact, it's impossible.
> > And when the arguments are renamed during the minification, all
> > the labels in function calls can be minified accordingly too.
>
> You can't statically determine which function will be called. Minifier
> CAN'T know in general case if your $(selector='wow') calls jQuery or
> some other function at minify time.
>
> So: you can't rely on optional parameters in any CDN-distributed file
> (because your minifier doesn't know about it's pre-minification
> identifiers), minifier have to avoid any parameters names clash at any
> cost.
>
> Possible solution: add gramar explicitly declare optional parameters
> by keyword to avoid minifaction of their names names.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150713/80c15395/attachment.html>
More information about the es-discuss
mailing list