Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:66057 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99465 invoked from network); 20 Feb 2013 11:47:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Feb 2013 11:47:40 -0000 Authentication-Results: pb1.pair.com smtp.mail=addw@phcomp.co.uk; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=addw@phcomp.co.uk; sender-id=permerror Received-SPF: pass (pb1.pair.com: domain phcomp.co.uk designates 78.32.209.33 as permitted sender) X-PHP-List-Original-Sender: addw@phcomp.co.uk X-Host-Fingerprint: 78.32.209.33 freshmint.phcomp.co.uk Received: from [78.32.209.33] ([78.32.209.33:50330] helo=mint.phcomp.co.uk) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CE/7F-19387-8D7B4215 for ; Wed, 20 Feb 2013 06:47:39 -0500 Received: from addw by mint.phcomp.co.uk with local (Exim 4.72) (envelope-from ) id 1U8897-0005vS-7l; Wed, 20 Feb 2013 11:47:33 +0000 Date: Wed, 20 Feb 2013 11:47:33 +0000 To: Sara Golemon Cc: PHP internals Message-ID: <20130220114733.GM31240@phcomp.co.uk> Mail-Followup-To: Sara Golemon , PHP internals References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Parliament Hill Computers Ltd User-Agent: Mutt/1.5.20 (2009-12-10) Subject: Re: [PHP-DEV] Re: [RFC] Allow trailing comma in function call argument lists From: addw@phcomp.co.uk (Alain Williams) On Wed, Feb 20, 2013 at 03:26:26AM -0800, Sara Golemon wrote: > On Tue, Feb 19, 2013 at 4:06 AM, Sara Golemon wrote: > > Opening RFC to allow trailing comma in function call argument lists > > > > https://wiki.php.net/rfc/trailing-comma-function-args > > > For the record, I've updated the RFC just now to include > function/method/closure declarations as well: > > function foo( > $bar, > $baz, > ) { > > } > > Not a pattern I see as much, but for the sake of consistency, it > doesn't hurt to put it on the table for discussion. I would argue against the RFC. The trailing comma is useful with arrays since it is not uncommon that members need to be added to an array over time. This is often as a result of changes outside of the program (eg: another user added to an ACL). Such a change does not alter the purpose or functionality that is represented by the array, it just does it for more somethings (users in my example). Much source/version control is line based and so trailing commas helps keep differences short. With functions: I do not see arguments being added in the same way, ie you are getting the function to do more of the same by adding an extra argument. If an extra argument is added it is because what the function does has changed in some way. This is very different from the just-a-bit-more scenario that you have with arrays. If a function has a list of arguments that is expected to change, many programmers would do that by passing an array to the function and arrays can already have trailing commands .... Also: many other languages (eg C, Perl) allow a trailing comma in arrays, but not to function arguments. This change would make PHP different from what many programmers might expect. -- Alain Williams Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer. +44 (0) 787 668 0256 http://www.phcomp.co.uk/ Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php #include