rfc:simplified_named_params
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
rfc:simplified_named_params [2016/01/18 22:38] – created mindplay | rfc:simplified_named_params [2021/01/13 15:22] (current) – named_params has been accepted, so this RFC is obsolete cmb | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== PHP RFC: Simplified Named Arguments ====== | ====== PHP RFC: Simplified Named Arguments ====== | ||
- | * Version: 0.1 | + | * Version: 0.2 |
* Date: 2016-01-18 | * Date: 2016-01-18 | ||
* Author: Rasmus Schultz < | * Author: Rasmus Schultz < | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
Line 94: | Line 94: | ||
Instead, upon encountering an unmatched named argument, a useful error message will be generated by scanning upwards through any parent class/ | Instead, upon encountering an unmatched named argument, a useful error message will be generated by scanning upwards through any parent class/ | ||
- | Although this causes potential problems with named arguments applied to existing code, the problem is considered minor, since most existing code does not use long argument lists intended to be called using named arguments - most existing code with many options, for lack of better, likely uses a '' | + | Although this causes potential problems with named arguments applied to existing code, the problem is considered minor, since most existing code does not use long argument lists intended to be called using named arguments - most existing code with many options, for lack of better, likely uses a '' |
+ | |||
+ | ==== Magic Methods ==== | ||
+ | |||
+ | Named arguments, are not applicable to magic methods implemented via '' | ||
+ | |||
+ | As for implementations of '' | ||
==== Impact on Reflection ==== | ==== Impact on Reflection ==== | ||
Line 100: | Line 106: | ||
This proposal has no impact on reflection. | This proposal has no impact on reflection. | ||
- | ===== Differences from Existing | + | ===== Differences from Previous |
Since this is a simplified proposal, compared to the one previously proposed by Nikita Popov, the following section will cover non-features and differences of this proposal as compared to that. | Since this is a simplified proposal, compared to the one previously proposed by Nikita Popov, the following section will cover non-features and differences of this proposal as compared to that. | ||
Line 185: | Line 191: | ||
Dealing with these issues when using open sets of options, passed via arrays, is an issue you deliberately elect to deal with - the principle behind this RFC, is that named arguments must map strictly to declared parameters, otherwise you might as well be using a single array of options as the only argument. | Dealing with these issues when using open sets of options, passed via arrays, is an issue you deliberately elect to deal with - the principle behind this RFC, is that named arguments must map strictly to declared parameters, otherwise you might as well be using a single array of options as the only argument. | ||
+ | |||
+ | ===== Notes on Syntax ===== | ||
+ | |||
+ | The proposed syntax resembles that of object literals in JS, and conflicts with an [[https:// | ||
+ | |||
+ | Regarding potential confusion over similarity to object literals in JS, curly braces are widely used in various languages to delimit the start and end of functions, conditional blocks, object literals, etc. - and arrays in PHP are probably closer in nature to JS objects than '' | ||
+ | |||
+ | If implemented, | ||
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== |
rfc/simplified_named_params.1453156696.txt.gz · Last modified: 2017/09/22 13:28 (external edit)