Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68678 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 255 invoked from network); 29 Aug 2013 11:10:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Aug 2013 11:10:50 -0000 Authentication-Results: pb1.pair.com header.from=patrick.allaert@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=patrick.allaert@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.41 as permitted sender) X-PHP-List-Original-Sender: patrick.allaert@gmail.com X-Host-Fingerprint: 209.85.219.41 mail-oa0-f41.google.com Received: from [209.85.219.41] ([209.85.219.41:57493] helo=mail-oa0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E3/02-23883-93C2F125 for ; Thu, 29 Aug 2013 07:10:50 -0400 Received: by mail-oa0-f41.google.com with SMTP id j17so264028oag.28 for ; Thu, 29 Aug 2013 04:10:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=49i5H+eNjNXY9GBdc/g0D3vBbd90RJDDd1pLHflvQMc=; b=Gqf46Giy/31/f1Bu9ovTOJ3OX+mGtBw4Ad93MQYbJJ5x9fu13KKL0xKTCEU+Q07Uaq 4VzbmoIigAJYTFsL2HhtqUdQcM7RuD4T2ci/hIbKTHzXd8csmu3jiKjsVMxnTKvcj8Uk GODDgO3f7rRcsGdqgAKTTaeWp+q6WyrJQNuTL9T3YFrCPiOokGQlKe2g2wrQspxXqGMT +4N4KOHVtxSJ6z2ABd5lOqS6dRg5PX3XHugg6UNaC64As6eumwgAmXaPKAk49PoIRUnn qolTbuFo/rBneS1/XRy6jiZWxP7//6yBPzZJX/XA8jbn0Nb2bMCC79bDWICzsso5SJGH Swhg== MIME-Version: 1.0 X-Received: by 10.60.60.105 with SMTP id g9mr2101386oer.8.1377774646929; Thu, 29 Aug 2013 04:10:46 -0700 (PDT) Sender: patrick.allaert@gmail.com Received: by 10.76.173.34 with HTTP; Thu, 29 Aug 2013 04:10:46 -0700 (PDT) In-Reply-To: References: Date: Thu, 29 Aug 2013 13:10:46 +0200 X-Google-Sender-Auth: IKqGGPJYD7T1KbySOhs0wYMKGR8 Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] Syntax for variadic functions From: patrickallaert@php.net (Patrick ALLAERT) 2013/8/28 Nikita Popov : > Hi internals! > > I'd like to propose an RFC, which adds dedicated syntax for variadic > functions: > > https://wiki.php.net/rfc/variadics > > Basically this allows declaring variadics directly in the function > signature, rather than fetching the arguments using func_get_args(). > Example: > > public function query($query, ...$params) { /* ... */ } > > What are your thoughts on this? > > Thanks, > Nikita Using the current variadic functions makes it possible to use 0 or N arguments, e.g.: function sum() { return array_sum(func_get_args()); } echo sum(10, 5); // echoes 15 echo sum(); // echoes 0 I see nowhere in the RFC whether: function sum(...$params) { /* */ } Requires at minimum one argument or none. I have the _feeling_ that you imply it's minimum one which I would consider a bit inconsistent with the current "implementation". Can you please clarify this Nikita? Thanks