Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68656 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39040 invoked from network); 28 Aug 2013 22:09:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Aug 2013 22:09:24 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 108.166.43.91 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 108.166.43.91 smtp91.ord1c.emailsrvr.com Linux 2.6 Received: from [108.166.43.91] ([108.166.43.91:39101] helo=smtp91.ord1c.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 03/68-33204-3157E125 for ; Wed, 28 Aug 2013 18:09:23 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp4.relay.ord1c.emailsrvr.com (SMTP Server) with ESMTP id 0429D140131; Wed, 28 Aug 2013 18:09:20 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp4.relay.ord1c.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id AF51C140103; Wed, 28 Aug 2013 18:09:19 -0400 (EDT) Message-ID: <521E750F.6070800@sugarcrm.com> Date: Wed, 28 Aug 2013 15:09:19 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Nikita Popov CC: PHP internals References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Syntax for variadic functions From: smalyshev@sugarcrm.com (Stas Malyshev) 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 wonder if this makes harder to implement named argument in the future - which I think we still need to be looking at - but so far doesn't look like it presents any additional problem compared to func_get_args(). For prototype checks, this: public function query($query, ...$params); public function query($query, $param = null, ...$params); Should be compatible. Same with: public function query($query, ...$params); public function query($query); functions should be able to ignore some arguments, especially ones that are optional anyway. I also think this: public function query($query, ...$params) public function query(...$params) should be legal too. I think it should also be explicitly specified what $params is if there is no arguments - null? false? array()? I'd probably prefer array as it makes it easy to do something like: public __construct(...$params) { foreach($params as $k => $v) { $this->$k = $v; } } but in any way it should be specified. I didn't look at the implementation yet, so I'll add comments on that later. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227