rfc:skipparams
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
rfc:skipparams [2015/01/03 01:28] – stas | rfc:skipparams [2015/02/08 08:12] – stas | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Skipping optional parameters for functions ====== | ====== Skipping optional parameters for functions ====== | ||
- | * Version: | + | * Version: |
- | * Date: 2013-09-01 | + | * Date: 2015-01-01 |
* Author: Stas Malyshev < | * Author: Stas Malyshev < | ||
- | * Status: | + | * Status: |
* Implementation: | * Implementation: | ||
===== Introduction ===== | ===== Introduction ===== | ||
- | As PHP does not have named parameter support, a very 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: |
| | ||
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 | + | See example implementation |
+ | |||
+ | 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, | ||
+ | |||
+ | ===== 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=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
+ | |||
+ | The vote concludes on the end of the day, PST, February 21th. | ||
===== Changelog ===== | ===== Changelog ===== |
rfc/skipparams.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1