> What alternative do you want?
> 
> 1. Parameter default value before default-free parameter means call without 
> arity match throws?
> 
> 2. What Oliver may have feared in switching to named parameters: actual 
> argument list shorter than formal list with default on left causes parameter 
> binding to skip defaults? This is not coherent:
> 
> function foo(x, y = a, z = y) {...}
> 
> foo()        // x=undefined, y=a, z=a
> foo(1)       // x=1, y=a, z=a
> foo(1, 2)    // x=1, y=a, z=2???
> foo(1, 2, 3) // x=1, y=2, z=3
> 
> 3. What ES6 draft says.


The only thing I can see are two, mutually exclusive, modes:

1. Trailing optional positional parameters.
2. Leading optional positional parameters.

There are a few cases, were #2 would be useful. I don’t see other alternatives 
that make sense. But that may be due to a lack of understand why one would want 
to have default values in an order that is neither #1 nor #2.

Axel

-- 
Dr. Axel Rauschmayer
a...@rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to