rfc:is_list

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
rfc:is_list [2021/01/06 00:24] – array_is_list(array $array): bool tandrerfc:is_list [2021/01/20 23:51] (current) – end vote tandre
Line 1: Line 1:
 ====== PHP RFC: Add array_is_list(array $array): bool ====== ====== PHP RFC: Add array_is_list(array $array): bool ======
-  * Version: 0.2+  * Version: 0.3
   * Date: 2020-12-19   * Date: 2020-12-19
   * Author: Tyson Andre <tandre@php.net>   * Author: Tyson Andre <tandre@php.net>
-  * Status: Under Discussion+  * Status: Implemented
   * Implementation: https://github.com/php/php-src/pull/6070   * Implementation: https://github.com/php/php-src/pull/6070
   * First Published at: https://wiki.php.net/rfc/is_list   * First Published at: https://wiki.php.net/rfc/is_list
Line 58: Line 58:
  
  
-===== Proposed PHP Version(s) =====+===== Proposed PHP Version =====
 8.1 8.1
  
Line 67: Line 67:
 Opcache's architecture does not change because the type system is unchanged; optimizations of ''array_is_list()'' can easily be added or removed. Opcache's architecture does not change because the type system is unchanged; optimizations of ''array_is_list()'' can easily be added or removed.
  
-In the RFC's implementation, opcache evaluates the call ''array_is_list(arg)'' to a constant if the argument is a constant value.+In the RFC's implementation, opcache evaluates the call ''array_is_list(arg)'' to a constant if the argument is a constant value and doesn't throw (same mechanism currently used for ''array_keys'', etc.).
  
 Long-term, if this sees wide enough adoption to affect performance on widely used apps or frameworks, opcache's contributors will have the option of adding additional checks to make opcache infer that ''array_is_list()'' being true implies that the keys of the array are integers. Long-term, if this sees wide enough adoption to affect performance on widely used apps or frameworks, opcache's contributors will have the option of adding additional checks to make opcache infer that ''array_is_list()'' being true implies that the keys of the array are integers.
Line 107: Line 107:
 Additionally, a name of ''is_list'' may cause confusion with built-in list types such as ''SplDoublyLinkedList''. Additionally, a name of ''is_list'' may cause confusion with built-in list types such as ''SplDoublyLinkedList''.
  
-===== Proposed Voting Choices ===== +===== Vote ===== 
-Yes/No, requiring 2/3 majority+ 
 +Voting started on 2021-01-06 and ended 2021-01-20 
 + 
 +This is a Yes/No vote, requiring 2/3 majority 
 + 
 +<doodle title="Add the function array_is_list(array $array): bool to PHP?" auth="tandre" voteType="single" closed="true"> 
 +   * Yes 
 +   * No 
 +</doodle>
  
 ===== References ===== ===== References =====
Line 198: Line 206:
 ===== Changelog ====== ===== Changelog ======
  
-0.3: Change name and signature from ''is_array_and_list(mixed $value)'' to ''array_is_list(array $array)'' +  * 0.3: Change name and signature from ''is_array_and_list(mixed $value)'' to ''array_is_list(array $array)'' 
-0.2: Rename from ''is_list()'' to ''is_array_and_list()'', add references and more rejected features+  0.2: Rename from ''is_list()'' to ''is_array_and_list()'', add references and more rejected features
  
rfc/is_list.1609892650.txt.gz · Last modified: 2021/01/06 00:24 by tandre