Default argument values

Waldemar Horwat waldemar at google.com
Mon Mar 3 12:59:24 PST 2008


Steven Mascaro wrote:
> One last issue. I was going to leave it till later, but I realised it
> may affect ES4.
> 
> The nicest syntax for named arguments would be to use ':', just like
> with object literals. e.g.:
> 
> /// Define
> function foo(arg1 = 0, arg2 = 1) { ... }
> 
> /// Call
> foo(arg2: 10, arg1: 5);
> 
> (I find this even more attractive than the Python syntax.) But this
> could potentially conflict with the type annotation syntax. e.g.:
> 
> /// Call
> foo(arg1: ClassA, arg2);
> 
> At the moment, the RI throws a ParseError for that, so there's no
> conflict. I'd like to request that this syntax be reserved solely for
> named arguments.

Fair enough.  I don't see any issues with preserving that call syntax for the future.

    Waldemar



More information about the Es4-discuss mailing list