On Wed, Jun 17, 2015 at 12:36 PM, Ferenc Kovacs <tyr...@gmail.com> wrote:
> On Wed, Jun 17, 2015 at 2:05 PM, Christian Schneider < > cschn...@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