rfc:short_closures
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:short_closures [2015/05/01 19:21] – bwoebi | rfc:short_closures [2017/09/22 13:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2015-05-01 | * Date: 2015-05-01 | ||
* Author: Bob Weinand, bobwei9@hotmail.com | * Author: Bob Weinand, bobwei9@hotmail.com | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
Line 78: | Line 78: | ||
Also, parameter_list does //not// include default values nor type hints. See also the 'Type Hints and Return Types' section at the bottom. | Also, parameter_list does //not// include default values nor type hints. See also the 'Type Hints and Return Types' section at the bottom. | ||
+ | |||
+ | // | ||
+ | This RFC stance is that chained short Closures followed by a full Closure would look quite weird: '' | ||
+ | |||
+ | // | ||
+ | While it might appear not consistent, with any other number of parameters, a lot of languages having extra short Closures allow this. Also, Closures with just one parameter are relatively common, so this RFC author thinks it is worth supporting that. | ||
==== Variable binding ==== | ==== Variable binding ==== | ||
Line 255: | Line 261: | ||
return [$x => $x * 2]; | return [$x => $x * 2]; | ||
</ | </ | ||
+ | |||
+ | Additionally, | ||
+ | |||
+ | Also, Hack has some possibilities of typing here, which do not work with PHP, due to technical reasons. Regarding forward compatibility, | ||
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
Line 270: | Line 280: | ||
private $bar: | private $bar: | ||
- | getBar ~> $this-> | + | getBar() ~> $this-> |
setBar($bar) ~> $this-> | setBar($bar) ~> $this-> | ||
} | } | ||
Line 285: | Line 295: | ||
As an alternative, | As an alternative, | ||
- | ===== Proposed Voting Choices | + | ===== Vote ===== |
This RFC is a language change and as such needs a 2/3 majority. | This RFC is a language change and as such needs a 2/3 majority. | ||
- | It will be a simple yes/no vote. | + | Voting opened September 22th, 2015 and will remain open until October 2nd, 2015. |
+ | |||
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
===== Patch ===== | ===== Patch ===== | ||
Pull request is at https:// | Pull request is at https:// |
rfc/short_closures.1430508109.txt.gz · Last modified: 2017/09/22 13:28 (external edit)