Re: [RFC] Skipping parameters take 2

From: Date: Mon, 19 Jan 2015 18:48:49 +0000
Subject: Re: [RFC] Skipping parameters take 2
References: 1 2 3 4 5 6 7 8 9  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
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. :)


Thread (69 messages)

« previous php.internals (#80844) next »