On 17 January 2015 at 18:04, Andrea Faulds <[email protected]> wrote:
> For consistency with list(), we could also just put nothing:
>
>
> foo($bar, , $baz);
>
> Which is like:
>
> list($bar, , $baz) = $arr;
>
> Thoughts?
That was Stas's original, original proposal way back when. I argued
then for having "default" as a placeholder, and still would today — in
the case where a function with, say, ten optional parameters[0] is
being called and eight of them should be the default, I think it's a
bit rough for somebody inheriting that code to have to count commas.
Having a token increases readability, IMO, and costs us nothing except
a few keystrokes, which isn't going to break the camel's back in a
language that requires "function" each time you declare a function.
Adam
[0] Yes, that's probably poor API design. You and I both know someone
will do it, though. :)