rfc:trailing-comma-function-args

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
rfc:trailing-comma-function-args [2013/02/19 12:04] – created pollitarfc:trailing-comma-function-args [2017/09/22 13:28] (current) – external edit 127.0.0.1
Line 1: Line 1:
-====== Request for Comments: How to write RFCs ======+====== Request for Comments: Trailing comma function args ======
   * Version: 1.0   * Version: 1.0
   * Date: 2013-02-19   * Date: 2013-02-19
   * Author: Sara Golemon <pollita@php.net>   * Author: Sara Golemon <pollita@php.net>
-  * Status: Under Discussion+  * Status: Rejected
   * First Published at: http://wiki.php.net/rfc/trailing-comma-function-args   * First Published at: http://wiki.php.net/rfc/trailing-comma-function-args
  
Line 30: Line 30:
 Which means that adding additional parameters to the call forces touching both the new line and the prior one, which is bad for VCS history. Which means that adding additional parameters to the call forces touching both the new line and the prior one, which is bad for VCS history.
  
-This RFC proposes to allow trailing commas in function and method call argument lists.+Similarly, function declarations have the same inconsistency with array() and list().
  
-===== The patch =====+  <?php 
 +  // Invalid currently 
 +  function foo( 
 +             $bar, 
 +             ) { 
 +    /* ... */ 
 +  }
  
-Could not be much simpler...+This RFC proposes to allow trailing commas in function and method call argument lists and function argument declarations.
  
-  diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y +===== The patch =====
-  index ccbc9b1..2e41dc0 100644 +
-  --- a/Zend/zend_language_parser.y +
-  +++ b/Zend/zend_language_parser.y +
-  @@ -543,6 +543,7 @@ optional_class_type: +
-   function_call_parameter_list: +
-                  '(' ')' { Z_LVAL($$.u.constant) 0; } +
-          |       '(' non_empty_function_call_parameter_list ')'  { $$ $2; } +
-  +             '(' non_empty_function_call_parameter_list ',' ')' { $$ $2; } +
-          |       '(' yield_expr ')'      { Z_LVAL($$.u.constant) 1; zend_do_pass_param(&$2, ZEND_SEND_VAL, Z_LVAL($$.u.constant) TSRMLS_CC); } +
-   ; +
- +
  
 +https://github.com/sgolemon/php-src/compare/master...trailing-comma
 +
 +HipHop version: https://github.com/facebook/hiphop-php/commit/c1b7da6a4c128af5ddfc75f515c205de9f417a1e
 ===== What's left out on purpose ===== ===== What's left out on purpose =====
  
Line 71: Line 69:
   }   }
  
-===== Tests =====+===== Vote ===== 
 + 
 +Note: Consideration for 5.6 inclusion, not 5.5. 
 + 
 +<doodle  
 +title="Should the current optional trailing comma implementation be merged" auth="pollita" voteType="single" closed="True"> 
 +   * Yes 
 +   * No 
 +</doodle>
  
-Yes, I'll write some.+===== Changelog =====
  
 +  * Expanded proposal to include declarations as well as arguments 2013-02-20 11:23 GMT
rfc/trailing-comma-function-args.1361275474.txt.gz · Last modified: 2017/09/22 13:28 (external edit)