On Wednesday, 3 June 2015 at 22:16:03 UTC, extrawurst wrote:
defining a assoc array parameter would make me expect exactly that: that it takes a assoc array as a paramter.

Sure then, but the variadic declaration should hold significance too, no? I would expect a function declared as

     foo(int[string] value);

to take an assoc array parameter, but a function declared as

     foo(int[string] value...);

to also provide some sort of variadic functionality on top of that. The resolution would be to either offer a calling syntax that can take advantage of this, or to make such a declaration to produce an error. As it is, there exists a valid, undocumented parameter declaration type in the language that serves no purpose.

whats the benefit of implementing this special case ? you save exactly 2 keystrokes ?

The same can be said of any variadic function, as they could all be called in the same manner,

     foo([1, 2, 3]); // vs. foo(1, 2, 3);

The benefit is that of syntactic neatness and visual balance, as well as helping with readability.

Reply via email to