Continuing woes in reading the ES6 spec language

Sebastian Zartner sebastianzartner at gmail.com
Fri Sep 13 14:52:34 PDT 2013


>
> > * You can pass undefined to trigger defaulting -- this is important for
> composition / delegation.
> No, it's a terrible feature :D i'm unaware of any language that supports
> arbitrary ordering of arguments.
>

FWIW, ColdFusion allows to call functions with named parameters in an
arbitrary order.[1] This has one benefit: You can simply skip arguments in
the middle instead of having to provide a default value for them the call.

Transferred to JS syntax that would be:

function sayHello(a, b=true, c="people")
{
    return b ? a + " " + c : a;
}

foo(a="Hey", c="there!"); // returns "Hey there!"

(Excuse the poor example, but it should be enough to understand the idea
behind it.)

Sebastian

[1]
http://stackoverflow.com/questions/1071396/how-to-specify-only-some-optional-arguments-when-calling-function-in-coldfusion
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130913/1b0afeb4/attachment-0001.html>


More information about the es-discuss mailing list