Re: Proposal: Dangling comma in function call parameters

From: Date: Wed, 22 Oct 2003 21:59:59 +0000
Subject: Re: Proposal: Dangling comma in function call parameters
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-4922@lists.php.net to get a copy of this message
At 11:32 PM 10/22/2003 +0200, Christian Schneider wrote:
Hello everybody, just joined the internals list (after being absent from php developers lists for a while) so excuse my ignorance if any topic I bring up has been discussed already. I checked the archives but couldn't find anything... Proposal: Allow dangling commas in function call parameters. Reasoning: We use some handy vararg tool functions and it's nice to be able to write foo(
        1,
        2,
        3,
); since it's then easy to add a new parameter without having to add a comma to the previous list. This would be symmetrical to the array() syntax. The patch for zend (php4 from cvs) would be minimal and I can't see any backwards-compatibility issues right now (patch attached). Any opinions?
The only reason array() supports this is because there are some cases where people auto-generate initialization files which have a huge array() construct and it makes it slightly easier (don't have the last element problem). In this case I don't see the same advantage and I see a disadvantage in readability and the possibility for PHP to give such an empty argument a meaning in future (although I doubt that'll happen). So -1 from me. Andi

« previous php.internals (#4922) next »