rfc:cachediterable

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
rfc:cachediterable [2021/06/15 13:47]
tandre
rfc:cachediterable [2021/06/29 14:24] (current)
tandre
Line 3: Line 3:
   * Date: 2021-02-06   * Date: 2021-02-06
   * Author: Tyson Andre, tandre@php.net   * Author: Tyson Andre, tandre@php.net
-  * Status: Under Discussion+  * Status: Declined
   * Implementation: https://github.com/php/php-src/pull/6655   * Implementation: https://github.com/php/php-src/pull/6655
   * First Published at: https://wiki.php.net/rfc/cachediterable   * First Published at: https://wiki.php.net/rfc/cachediterable
Line 11: Line 11:
 Currently, PHP does not provide a built-in way to store the state of an arbitrary iterable for reuse later (when the iterable has arbitrary keys, or when keys might be repeated). It would be useful to do so for many use cases, such as: Currently, PHP does not provide a built-in way to store the state of an arbitrary iterable for reuse later (when the iterable has arbitrary keys, or when keys might be repeated). It would be useful to do so for many use cases, such as:
  
-  - Creating a rewindable copy of a non-rewindable Traversable (e.g. a ''Generator'') before passing that copy to a function that consumes an iterable/Traversable. (''new CachedIterator(my_generator())'')+  - Creating a rewindable copy of a non-rewindable Traversable (e.g. a ''Generator'') before passing that copy to a function that consumes an iterable/Traversable. (''new ImmutableIterable(my_generator())'')
   - Generating an ''IteratorAggregate'' from a class still implementing ''Iterator'' (e.g. ''SplObjectStorage'') so that code can independently iterate over the key-value sequences. \\ (e.g. ''foreach ($immutableKeyValueSequence as $k1 => $v1) { foreach ($immutableKeyValueSequence as $k2 => $v2) { /* process pairs */ } }'')   - Generating an ''IteratorAggregate'' from a class still implementing ''Iterator'' (e.g. ''SplObjectStorage'') so that code can independently iterate over the key-value sequences. \\ (e.g. ''foreach ($immutableKeyValueSequence as $k1 => $v1) { foreach ($immutableKeyValueSequence as $k2 => $v2) { /* process pairs */ } }'')
   - Providing internal or userland helpers such as ''iterable_flip(iterable $input)'', ''iterable_take(iterable $input, int $limit)'', ''iterable_chunk(iterable $input, int $chunk_size)'' that act on iterables with arbitrary key/value sequences and have return values including iterables with arbitrary key/value sequences   - Providing internal or userland helpers such as ''iterable_flip(iterable $input)'', ''iterable_take(iterable $input, int $limit)'', ''iterable_chunk(iterable $input, int $chunk_size)'' that act on iterables with arbitrary key/value sequences and have return values including iterables with arbitrary key/value sequences
Line 349: Line 349:
 This is a Yes/No vote, requiring a 2/3 majority. Voting started on June 15, 2021 and ends on June 29, 2021. This is a Yes/No vote, requiring a 2/3 majority. Voting started on June 15, 2021 and ends on June 29, 2021.
  
-<doodle title="Add ImmutableIterable to core" auth="tandre" voteType="single" closed="false">+<doodle title="Add ImmutableIterable to core" auth="tandre" voteType="single" closed="true">
    * Yes    * Yes
    * No    * No
Line 356: Line 356:
 ==== Poll: Reason for voting against this RFC ==== ==== Poll: Reason for voting against this RFC ====
  
-<doodle title="Reasons for voting against the ImmutableIterable RFC" auth="tandre" voteType="multi" closed="false">+<doodle title="Reasons for voting against the ImmutableIterable RFC" auth="tandre" voteType="multi" closed="true">
    * Object to the namespace choice    * Object to the namespace choice
    * Object to the name    * Object to the name
Line 369: Line 369:
   * [[rfc:cachediterable_straw_poll|Straw poll: Namespace to use for CachedIterable and iterable functionality]]   * [[rfc:cachediterable_straw_poll|Straw poll: Namespace to use for CachedIterable and iterable functionality]]
   * https://externals.io/message/114834  RFC: CachedIterable (rewindable, allows any key&repeating keys)   * https://externals.io/message/114834  RFC: CachedIterable (rewindable, allows any key&repeating keys)
 +  * [[https://externals.io/message/114887|[VOTE] ImmutableIterable (immutable, rewindable, allows any key&repeating keys)]]
  
 ===== Rejected Features ===== ===== Rejected Features =====
rfc/cachediterable.1623764832.txt.gz · Last modified: 2021/06/15 13:47 by tandre