Re: rfc:trailing-comma-function-args

From: Date: Fri, 22 Feb 2013 21:46:49 +0000
Subject: Re: rfc:trailing-comma-function-args
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-66165@lists.php.net to get a copy of this message
2013/2/22 Rasmus Schultz <rasmus@mindplay.dk> > I've been thinking about this RCF for a while now: > > https://wiki.php.net/rfc/trailing-comma-function-args > > It just doesn't seem necessary - the only time I've ever found something > like this to be necessary, is when a function takes closures or other very > long arguments, some of which are optional... I must say, that I find this RFC completely useless. In my opinion when one has such a long parameter list (or too long variable names), that he must break the call onto several lines, the additional line in the vcs' diff is the minor problem. > but actually, writing this in > a VCS-friendly way is already possible: > > $tree->traverse( > $tree > , > function($node) { > // ... > } > ); > > ... version 2 ... > > $tree->traverse( > $tree > , > function($node) { > // ... > } > , > function($node) { > // ... > } > ); > > This actually comes out more legible, in my opinion. > > What really irks me about this patch, is that the trailing comma implies > that another optional argument may exist - it really doesn't make the code > more intuitive to read. The example on the page (using fopen) really isn't > a realistic use-case - who would break a couple of simple arguments into > individual lines like that? > /sign Especially about the "implies, that another optional argument may exist": One does not simply add arbitrary arguments to a function call. Except when the function signature changes, but in this case (to repeat myself) the additional diff-line is negligible. > > Just my two cents... > My too > > - Rasmus > -- github.com/KingCrunch

« previous php.internals (#66165) next »