Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86735 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21234 invoked from network); 17 Jun 2015 16:53:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jun 2015 16:53:21 -0000 Authentication-Results: pb1.pair.com header.from=bishop.bettini@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=bishop.bettini@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.171 as permitted sender) X-PHP-List-Original-Sender: bishop.bettini@gmail.com X-Host-Fingerprint: 209.85.217.171 mail-lb0-f171.google.com Received: from [209.85.217.171] ([209.85.217.171:33179] helo=mail-lb0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D9/D0-12455-FF5A1855 for ; Wed, 17 Jun 2015 12:53:20 -0400 Received: by lblr1 with SMTP id r1so35855979lbl.0 for ; Wed, 17 Jun 2015 09:53:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=mbCbqJJV2WRICt9rJXC0t4/nMsu6yIEtaCd0CcVeBu8=; b=tGK+QCy7MxgYhdUuzMRDR4iFCTRJkQVbJaXWd9mXruCrXjI1hKj6d0FczQWsAncsRe ZlUxnRtzE/EqDvEgBjk1Q1Hmaa+OFIetaLExW8BfZ5f79A1BTWkuvnf2hDfYnKLfe8Re yq4xBs39V6BnCgYZ8WhG+bjwLZy0HBChXfaClu0yIpguWDnSLNV9UbuvHpliTFtW8LMV mrcxcXf3AaEBjje17xW+zOLzG92AaLcDIxsUM/qK4gjgEReHMLPDn4NgdYa+X9z4PrX8 nUW/MUSs9Slbr6w1Waj07DgJ1ByqUyeEiKc1wXQDYTm+kKeqXr2PShr5bkz6jb1i1HHz Omyg== MIME-Version: 1.0 X-Received: by 10.112.209.106 with SMTP id ml10mr8817085lbc.112.1434559996632; Wed, 17 Jun 2015 09:53:16 -0700 (PDT) Reply-To: bishop@php.net Sender: bishop.bettini@gmail.com Received: by 10.152.6.197 with HTTP; Wed, 17 Jun 2015 09:53:16 -0700 (PDT) In-Reply-To: References: <68262FAD-587B-47FF-B388-3B8551FDCA22@cschneid.com> Date: Wed, 17 Jun 2015 12:53:16 -0400 X-Google-Sender-Auth: tQOpI6NGMHgEypmFx97F2-EmVww Message-ID: To: Ferenc Kovacs Cc: Christian Schneider , PHP Development Content-Type: multipart/alternative; boundary=001a11c25ea00227160518b987b8 Subject: Re: [PHP-DEV] Revisit trailing commas in function call parameters? From: bishop@php.net (Bishop Bettini) --001a11c25ea00227160518b987b8 Content-Type: text/plain; charset=UTF-8 On Wed, Jun 17, 2015 at 12:36 PM, Ferenc Kovacs wrote: > On Wed, Jun 17, 2015 at 2:05 PM, Christian Schneider < > cschneid@cschneid.com> > wrote: > > > Hi there, > > now that syntax for variadic functions was added I quickly wanted to ask > > whether allowing trailing commas for function calls could be > reconsidered. > > > > It is a very small change to the language allowing something like > > my_variadic_function( > > "foo", > > "bar", > > "qux", > > ); > > which makes adding/removing additional parameters a little easier: No > > comma has to be added/removed from the last line. > > > > Previously this was considered unnecessary but maybe things changed > enough > > to reconsider it? It doesn't involve any BC break and I attached the very > > simple patch needed in the master branch. > > > > If people still consider it more harm- than useful then please don't > flame > > me and I'll shut up again :-) > > > hi, > > just linking to the previous rfc: > https://wiki.php.net/rfc/trailing-comma-function-args and discussion: > http://www.serverphorums.com/read.php?7,655532 > > I missed the vote on this one, but I'd be +1. That said, the VCS blame issue doesn't seem strong enough for me. Just put the comma at the front of the list item and you don't have to modify two lines: // initial state $fp = fopen( "sample.txt" , "r+" ); // modified state $fp = fopen( "sample.txt" , "r+" , true // only this line changed ); I realize this may grate on styles, and it doesn't quite align with recommendations made in canonical books like Code Complete, but it's a decent way to get around the VCS issue and "trailing comma errors" in syntaxes like JSON. And when you work in one language that doesn't have the PHP nicety of trailing comma, you either adopt the lowest common denominator (not using them) or take on the mental burden of doing both in context (and the risk of using the trailing in unsupported contexts). To me, the strongest argument is consistency. Thanks, bishop --001a11c25ea00227160518b987b8--