rfc:generator-return-expressions
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:generator-return-expressions [2015/03/09 15:49] – rewording rdlowrey | rfc:generator-return-expressions [2017/09/22 13:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 2: | Line 2: | ||
* Version: 0.1 | * Version: 0.1 | ||
* Date: 2015-02-18 | * Date: 2015-02-18 | ||
- | * Authors: Daniel Lowrey < | + | * Author: Daniel Lowrey < |
* Contributors: | * Contributors: | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
Line 170: | Line 170: | ||
return $bar + 42; // unambiguous execution " | return $bar + 42; // unambiguous execution " | ||
}; | }; | ||
+ | ?> | ||
</ | </ | ||
+ | |||
+ | |||
+ | ===== Reference Returns ===== | ||
+ | |||
+ | Generators currently utilize the `&` operator to indicate values will be yielded by-reference: | ||
+ | |||
+ | <code php> | ||
+ | <?php | ||
+ | function & | ||
+ | $value = 3; | ||
+ | |||
+ | while ($value > 0) { | ||
+ | yield $value; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | foreach (gen_reference() as & | ||
+ | echo (--$number).' | ||
+ | } | ||
+ | ?> | ||
+ | </ | ||
+ | |||
+ | As '' | ||
Line 254: | Line 278: | ||
- | ===== Proposed Voting Choices | + | ===== Vote ===== |
- | Two voting choices are proposed: | + | |
- | 1. **YES**, allow Generator return expressions | + | Voting begins 2015-03-09 |
- | + | ||
- | 2. **NO**, do not modify existing Generator behavior | + | |
A 2/3 " | A 2/3 " | ||
+ | |||
+ | |||
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
+ | |||
+ | . Vote closed at 14:50 UTC 2015-03-17. | ||
+ | |||
+ | **NOTE:** the related [[rfc: | ||
===== Patches and Tests ===== | ===== Patches and Tests ===== | ||
Line 277: | Line 308: | ||
[[https:// | [[https:// | ||
- | ===== Rejected Features ===== | ||
- | TBD |
rfc/generator-return-expressions.1425916183.txt.gz · Last modified: 2017/09/22 13:28 (external edit)