Re: [RFC] Skipping parameters take 2

From: Date: Mon, 02 Sep 2013 12:52:42 +0000
Subject: Re: [RFC] Skipping parameters take 2
References: 1 2  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
2013/9/2 Pierre Joye <[email protected]>

> hi Stas,
>
> On Mon, Sep 2, 2013 at 9:17 AM, Stas Malyshev <[email protected]>
> wrote:
> > 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 :)
>
> Using default instead of ,,, is indeed much more readable.
>
> However I still wonder what prevents to finally implement named
> parameters too, it will provide the same feature while being even more
> handy and easier.


And it covers an additional use-case: Self-explaning parameters like in
"foo(is_strict = false)" instead of "foo(null, null, false)".


> I could dig the archives but I don't remember what
> was the reason why we rejected the idea back then.
>
> Cheers,
> --
> Pierre
>
> @pierrejoye | http://www.libgd.org
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
github.com/KingCrunch


Thread (69 messages)

« previous php.internals (#68849) next »