Re: [RFC] skipping optional parameters
| From: | Peter Lind | Date: | Wed, 18 Apr 2012 06:01:40 +0000 |
| Subject: | Re: [RFC] skipping optional parameters | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-60155@lists.php.net to get a copy of this message | ||
On 18 April 2012 07:56, Alexey Shein <confik@gmail.com> wrote:
*snip*
>
> One question about implementation:
> Given we have this function
>> function create_query($where, $order_by, $join_type='', $execute = false,
>> $report_errors = true) {}
> and this statement
>> On the engine level, it will be implemented by putting NULL in the place where the
>> parameter is passed.
>
> what value $join_type will get on this call?
> create_query("deleted=0", "name",,, /*report_errors*/ true);
>
> NULL or empty string? I.e. will optional parameters always get NULLs
> or their default values?
It needs to be the default values, otherwise it will be a huge WTF for
developers.
With that in mind: +1 if default values are used when skipping
parameters, -1 if NULL is used when skipping parameters (not that I
have voting power, just showing preferences/support).
Regards
Peter
--
<hype>
WWW: plphp.dk / plind.dk
LinkedIn: plind
BeWelcome/Couchsurfing: Fake51
Twitter: kafe15
</hype>