rfc:skipparams

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
rfc:skipparams [2015/01/03 01:28] stasrfc:skipparams [2017/09/22 13:28] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== Skipping optional parameters for functions ====== ====== Skipping optional parameters for functions ======
-  * Version: 2.0 +  * Version: 3.0 
-  * Date: 2013-09-01+  * Date: 2015-01-01
   * Author: Stas Malyshev <stas@php.net>   * Author: Stas Malyshev <stas@php.net>
-  * Status: Under Discussion+  * Status: Declined
   * Implementation: https://github.com/smalyshev/php-src/tree/skip_params7   * Implementation: https://github.com/smalyshev/php-src/tree/skip_params7
 ===== Introduction ===== ===== Introduction =====
  
-As PHP does not have named parameter supportvery common for function is to have many optional arguments, like this:+In PHP, it is very common for function is to have many optional arguments, like this:
  
      function create_query($where, $order_by, $join_type='', $execute = false, $report_errors = true)      function create_query($where, $order_by, $join_type='', $execute = false, $report_errors = true)
Line 29: Line 29:
 On the engine level, it will be implemented by putting IS_UNDEF value in the place where the parameter is passed. Functions dealing with argument handling will be updated. On the engine level, it will be implemented by putting IS_UNDEF value in the place where the parameter is passed. Functions dealing with argument handling will be updated.
  
-See example implementation below. See tests for examples of most common uses cases. +See example implementation at: https://github.com/php/php-src/pull/981 
 + 
 +See tests there for examples of most common uses cases. 
  
 ===== User functions ===== ===== User functions =====
Line 80: Line 82:
        
 * Internal functions that declare parameters as optional but fail to provide proper defaults and rely on ZEND_NUM_ARGS to figure out if to use default or not may be broken. The patch fixes all instances of this in the core extensions, but third-party extensions may need to be fixed too. This applies only to ones that check ZEND_NUM_ARGS() manually in the code instead of using zend_parse_parameters(). * Internal functions that declare parameters as optional but fail to provide proper defaults and rely on ZEND_NUM_ARGS to figure out if to use default or not may be broken. The patch fixes all instances of this in the core extensions, but third-party extensions may need to be fixed too. This applies only to ones that check ZEND_NUM_ARGS() manually in the code instead of using zend_parse_parameters().
 +
 +* This RFC does not prevent named parameters implementation - in fact, a lot of cleanup to the code mentioned above is also necessary for named parameters implementation, since it would require the same level of care with providing the defaults. Both features can be used in parallel, and thus this RFC is a complimentary functionality for potential named parameters implementation.
 +
 +===== Vote =====
 +
 +Since this RFC changes the language semantics, the 2/3+1 vote majority is required for it to pass. The vote is a straight Yes/No vote. 
 +
 +<doodle title="Should PHP 7 support parameter skipping as described in this RFC?" auth="stas" voteType="single" closed="true">
 +   * Yes
 +   * No
 +</doodle>
 +
 +The vote concludes on the end of the day, PST, February 21th.
  
 ===== Changelog ===== ===== Changelog =====
rfc/skipparams.1420248481.txt.gz · Last modified: 2017/09/22 13:28 (external edit)