Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69156 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 79232 invoked from network); 16 Sep 2013 20:51:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Sep 2013 20:51:45 -0000 Authentication-Results: pb1.pair.com smtp.mail=zeev@zend.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=zeev@zend.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain zend.com from 209.85.128.175 cause and error) X-PHP-List-Original-Sender: zeev@zend.com X-Host-Fingerprint: 209.85.128.175 mail-ve0-f175.google.com Received: from [209.85.128.175] ([209.85.128.175:41843] helo=mail-ve0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D9/E3-57385-F5F67325 for ; Mon, 16 Sep 2013 16:51:44 -0400 Received: by mail-ve0-f175.google.com with SMTP id jy13so3393513veb.6 for ; Mon, 16 Sep 2013 13:51:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:references:in-reply-to:mime-version :thread-index:date:message-id:subject:to:cc:content-type; bh=KJcboJhoNMo+EYLqkjN+TdYVqws+mavuDYNxvIGKbVE=; b=TavOkLGzpxAWeYpSGBUjOH7K3AF6uMKclikuYfuX4K0iFFIkoi6MADSP131VgksIIl U/tk0yalcrxuQAO2Ac4vXoKqmL6pIibGJ1yCBvGQo49UUnRl9+VjAzKPhcbXl6Qkfkp0 J5NG+P3AE/IjyRQyj5w7HCG8b8NWO6gkOAM6bzBn5X9jVMCBfeBdjo36FfLL2c5xPDSz 1RPkZ4KAp5/86ITNt77sBMvHHuSjIC3vVZ+VKVcjYcTzUSa+tWiBtLLDj278VxGp5kEu CdKcyKFIOSZHsO1XZkpLavhVgQ7UTCR+Rtj9Psh44v2Pytb6ZdyJlNmW7rZ0k+gtOjcR CbNw== X-Gm-Message-State: ALoCoQnImrAQ+2FUJurckZJpbnlwVepE7EeGEp2CeFLsITEn11DdNo/nwStd6djp7imobJYv0pdxnufACObuhd4bEnFfNBmROt3amqM016ICk6P5V6+qQviuqVgq9gZSU+Sonz1jvqzA X-Received: by 10.58.218.225 with SMTP id pj1mr3110236vec.24.1379364700710; Mon, 16 Sep 2013 13:51:40 -0700 (PDT) References: <521E750F.6070800@sugarcrm.com> In-Reply-To: MIME-Version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQJbKA7IjQdeWQEHqGjD2+5ypdPJsgLB/Q9IAqjWn7EB55RK2ph1V2Xw Date: Mon, 16 Sep 2013 23:51:40 +0300 Message-ID: To: Nikita Popov , Stas Malyshev Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Subject: RE: [PHP-DEV] [RFC] Syntax for variadic functions From: zeev@zend.com (Zeev Suraski) > -----Original Message----- > From: Nikita Popov [mailto:nikita.ppv@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 > 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