rfc:iterator_chaining
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:iterator_chaining [2021/03/20 21:34] – maxsem | rfc:iterator_chaining [2021/03/21 14:32] (current) – maxsem | ||
---|---|---|---|
Line 22: | Line 22: | ||
Note how the order of writing is gorgeously opposite to the order of data flow. | Note how the order of writing is gorgeously opposite to the order of data flow. | ||
+ | |||
+ | Can we make it better? | ||
===== Proposal ===== | ===== Proposal ===== | ||
+ | I like how this is implemented Rust. Translated to PHP, that would look like: | ||
+ | <code php> | ||
+ | $iterator = $myIterator-> | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | Wouldn' | ||
**Create a trait** that extends iterators and allows to feed them into other iterators: | **Create a trait** that extends iterators and allows to feed them into other iterators: | ||
Line 30: | Line 40: | ||
trait IteratorChain { | trait IteratorChain { | ||
public function skip(int $count): LimitIterator {} | public function skip(int $count): LimitIterator {} | ||
- | public function | + | public function |
+ | public function skipAndLimit(int $numToSkip, int $limit): LimitIterator {} | ||
+ | public function regex(string $regex, int $mode = RegexIterator:: | ||
public function callbackFilter(callable $callback): CallbackIterator {} | public function callbackFilter(callable $callback): CallbackIterator {} | ||
public function noRewind(): NoRewindIterator {} | public function noRewind(): NoRewindIterator {} | ||
Line 48: | Line 60: | ||
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
- | What breaks, and what is the justification for it? | + | None. |
===== Proposed PHP Version(s) ===== | ===== Proposed PHP Version(s) ===== | ||
Line 57: | Line 69: | ||
===== Open Issues ===== | ===== Open Issues ===== | ||
- | Need to | + | Need to decide on precise details |
- | + | ||
- | ===== Unaffected PHP Functionality ===== | + | |
- | List existing areas/ | + | |
- | + | ||
- | This helps avoid any ambiguity, shows that you have thought deeply about the RFC's impact, and helps reduces mail list noise. | + | |
===== Future Scope ===== | ===== Future Scope ===== | ||
Line 68: | Line 75: | ||
===== Proposed Voting Choices ===== | ===== Proposed Voting Choices ===== | ||
- | Include these so readers know where you are heading and can discuss the proposed voting options. | + | Accept this RFC (yes/no)? - 2/3 votes required |
===== Patches and Tests ===== | ===== Patches and Tests ===== |
rfc/iterator_chaining.1616276066.txt.gz · Last modified: 2021/03/20 21:34 by maxsem