Marc Bennewitz, Stas,

> But I think adding "default" as new keyword is a big BC break!
> I personally also don't like it and asked myself why can't the parameter
simply skipped?

Default is already a reserved word AFAIK. But I've been thinking about
alternatives to parameter skipping syntax which brought  me the Golang
blank identifier _ to mind:

    create_query("deleted=0", "name", _, _, true);

Still not sure if it's better than `default`, though.

2015-01-14 16:15 GMT-03:00 Marc Bennewitz <dev@mabe.berlin>:

> Hi Stas,
>
> I really like this RFC. It makes it simple to use defined defaults without
> the need to know about them of to updated.
>
> But I think adding "default" as new keyword is a big BC break!
> I personally also don't like it and asked myself why can't the parameter
> simply skipped?
>
>     function foo ($a='a', $b='b') {}
>
>     foo();
>     foo($a);
>     foo(, $b);
>     foo($a,);
>     foo(,);
>
> Is it possible to use the default parameter on inheritance?
>
> class Bar {
>     function foo($a='a', $b='b') {}
> }
>
> class Baz extends Bar {
>     function foo($a=default, $b=default) {
>         // do something
>         parent::foo($a, $b);
>     }
> }
>
>
> Marc
>
>
> Am 02.09.2013 um 09:17 schrieb Stas Malyshev:
>
>> Hi!
>>
>> I've finally took some time to revive the skipping parameter RFC and
>> patch. For those who doesn't remember what it is please see:
>> https://wiki.php.net/rfc/skipparams
>> TLDR version:
>>
>> The idea is to allow skipping parameters in function with optional
>> arguments so that this:
>>     function create_query($where, $order_by, $join_type='INNER', $execute
>> = false, $report_errors = true)
>>
>> can be called like this:
>>      create_query("deleted=0", "name", default, default,
>> /*report_errors*/ true);
>>
>> Instead of trying to remember what the defaults are.
>> The patch is here:
>>
>> https://github.com/php/php-src/pull/426
>>
>> Any comments or feedback on the RFCs and the code are welcome,
>> especially pointing out the cases where it may not work (which means we
>> need more phpt's there :)
>>
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Reply via email to