> -----Original Message-----
> From: Nikita Popov [mailto:nikita....@gmail.com]
> Sent: Thursday, August 29, 2013 3:03 PM
> To: Stas Malyshev
> Cc: PHP internals
> Subject: Re: [PHP-DEV] [RFC] Syntax for variadic functions
>
> On Thu, Aug 29, 2013 at 12:09 AM, Stas Malyshev
> <smalys...@sugarcrm.com>wrote:
>
> > Hi!
> >
> > I like the idea, the concept of capturing "rest of args" is pretty
> > common. But couldn't we in addition have func_get_args() be able to
> > receive an int argument that would produce "the rest" in an easier way
> > for those that prefer func_ger_args()?
> >
>
> I would do that if this RFC doesn't pass, but I don't see much point
doing
> both things (syntax + extra arg). Are there any particular scenarios
where
> using func_get_args() would be preferable?

Admittedly I'm (very) late to the game, but admittedly #2 - I actually
just noticed this thread as it went up for a vote.
Personally I find Stas's direction preferable to introducing new semantics
- mainly because I think that with every new piece of syntax we make the
language a tad bit more complex no matter what.
Conversely, adding an optional argument to func_get_args() sticks with the
same spirit we've had for years regarding variadic functions, and arguably
is more versatile.  Assuming we implement a [, start[, end]] syntax
support, then you can more granularly split exactly the offsets you want -
in case you don't want all of them in one array (which would require a
call to array_slice() using the new syntax).  Before you jump and say it's
not such a common case - I agree - I said arguably :)

Zeev

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to