rfc:any_all_on_iterable_straw_poll_namespace

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:any_all_on_iterable_straw_poll_namespace [2021/01/17 14:21] tandrerfc:any_all_on_iterable_straw_poll_namespace [2021/02/03 00:30] (current) tandre
Line 1: Line 1:
 ====== Straw poll: Using namespaces for *any() and *all() on iterables ====== ====== Straw poll: Using namespaces for *any() and *all() on iterables ======
-  * Version: 0.1+  * Version: 0.2
   * Date: 2021-01-05   * Date: 2021-01-05
   * Author: Tyson Andre, tandre@php.net   * Author: Tyson Andre, tandre@php.net
-  * Status: Under Discussion+  * Status: Closed
   * First Published at: http://wiki.php.net/rfc/any_all_on_iterable_straw_poll_namespace   * First Published at: http://wiki.php.net/rfc/any_all_on_iterable_straw_poll_namespace
  
Line 25: Line 25:
 ===== Discussion ===== ===== Discussion =====
  
-==== Arguments for namespaces in general ====+==== Arguments for voting again on namespaces ====
  
 https://externals.io/message/112558 https://externals.io/message/112558
Line 128: Line 128:
  
 Mark Randall Mark Randall
 +</blockquote>
 +
 +From Nikita Popov: https://externals.io/message/112558#112780
 +
 +<blockquote>
 +Using just the SPL namespace (that is, SPL\any) makes the SPL namespace a
 +dumping ground for everything, as you said. Once you introduce an
 +additional meaningful namespace in the form of SPL\iterable\any, you are
 +better off either dropping the SPL part and arriving at iterable\any, or
 +replacing SPL with something more sensible and arriving at PHP\iterable\any.
 </blockquote> </blockquote>
  
Line 153: Line 163:
  
 I've also realized that ''use prefix\iterable'' would be mildly inconvenient for users of PHP and for tooling (refactoring tools, IDEs, etc) for PHP, I've also realized that ''use prefix\iterable'' would be mildly inconvenient for users of PHP and for tooling (refactoring tools, IDEs, etc) for PHP,
-but still include it as an option because it's unlikely to be a problem in practice  and the non-namespaced prefix iterable_ was preferred in the previous poll.+but still include it as an option because it'**unlikely to be a problem in practice  and the non-namespaced prefix iterable_ was preferred in the previous poll.**
  
 <code php> <code php>
Line 159: Line 169:
 php > \iterable\my_any(); // can be called with the fully qualified name php > \iterable\my_any(); // can be called with the fully qualified name
 in my_any() polyfill in my_any() polyfill
-php > namespace X { use iterable\my_any; my_any(); /* using individual functions works */ }+php > namespace X { use iterable\my_any; my_any(); /* using individual functions works and is how namespaced functions are often used */ 
 +in my_any() polyfill 
 +php > namespace { iterable\my_any(); }
 in my_any() polyfill in my_any() polyfill
-php > namespace W { echo iterable::class; } 
-W\iterable 
  
 +
 +
 +php > namespace W { echo iterable::class; /* Edge cases that should not be a problem in practice, but mentioned for completeness */ }
 +W\iterable
 php > namespace X { use iterable; } php > namespace X { use iterable; }
  
 Fatal error: Cannot use iterable as iterable because 'iterable' is a special class name in php shell code on line 1 Fatal error: Cannot use iterable as iterable because 'iterable' is a special class name in php shell code on line 1
 +php > namespace X { use PHP\iterable; }
 +
 +Fatal error: Cannot use PHP\iterable as iterable because 'iterable' is a special class name in php shell code on line 1
 +
 php > namespace X { use iterable as iter; iter\my_any(); } php > namespace X { use iterable as iter; iter\my_any(); }
 in my_any() polyfill in my_any() polyfill
Line 172: Line 190:
  
 ===== Vote ===== ===== Vote =====
 +
 +Voting started on 2021-01-19 and ended on 2021-02-02. Of the top two options, 12 voters had ranked "PHP\iterable" before the global namespace (including not listing the latter in their vote). 11 voters had ranked the global namespace ahead of "PHP\iterable" (including not listing the latter in the vote). One voter had ranked neither option.
  
 This vote will influence the name choice for the RFC https://wiki.php.net/rfc/any_all_on_iterable This vote will influence the name choice for the RFC https://wiki.php.net/rfc/any_all_on_iterable
Line 180: Line 200:
  
 **Clicking on vote will only submit your vote for the above question, not for all of them.** You may want to write down your choices to avoid losing track of them. To quickly return to the vote section, click on "Vote" in the Table of Contents on the right. **Clicking on vote will only submit your vote for the above question, not for all of them.** You may want to write down your choices to avoid losing track of them. To quickly return to the vote section, click on "Vote" in the Table of Contents on the right.
 +
 +  * no namespace: iterable_any()/iterable_all()
 +  * iter\ (conflicts with [[https://github.com/nikic/iter|nikic/iter]] but was among Nikita's suggestions)
 +  * iterable\ (see [[#arguments_foragainst_iterable_in_namespace|section on iterable\ ]] , also suggested by Nikita)
 +  * PHP\ (see [[#arguments_for_php|Arguments for PHP\]])
 +  * PHP\Spl\ (see [[#arguments_for_php|Arguments for PHP\]])
 +  * PHP\iter\ (see [[#arguments_for_php|Arguments for PHP\]])
 +  * PHP\iterable\ (see [[#arguments_for_php|Arguments for PHP\]])
 +  * Ext\Spl, as one interpretation of https://wiki.php.net/rfc/php_namespace_policy . Also see [[#arguments_for_php|Arguments for PHP\]] for PHP\Spl since this the new functions would be built in.
 +  * Spl\ (see [[#arguments_for_spl|Arguments for Spl\ ]] - suggested by Levi Morrison)
 +  * Spl\iter\
 +  * Spl\iterable\ 
 +
  
 First choice: First choice:
Line 187: Line 220:
    * iterable\    * iterable\
    * PHP\    * PHP\
 +   * PHP\Spl\
    * PHP\iter\    * PHP\iter\
    * PHP\iterable\    * PHP\iterable\
Line 202: Line 236:
    * iterable\    * iterable\
    * PHP\    * PHP\
 +   * PHP\Spl\
    * PHP\iter\    * PHP\iter\
    * PHP\iterable\    * PHP\iterable\
Line 217: Line 252:
    * iterable\    * iterable\
    * PHP\    * PHP\
 +   * PHP\Spl\
    * PHP\iter\    * PHP\iter\
    * PHP\iterable\    * PHP\iterable\
Line 232: Line 268:
    * iterable\    * iterable\
    * PHP\    * PHP\
 +   * PHP\Spl\
    * PHP\iter\    * PHP\iter\
    * PHP\iterable\    * PHP\iterable\
Line 247: Line 284:
    * iterable\    * iterable\
    * PHP\    * PHP\
 +   * PHP\Spl\
    * PHP\iter\    * PHP\iter\
    * PHP\iterable\    * PHP\iterable\
Line 262: Line 300:
    * iterable\    * iterable\
    * PHP\    * PHP\
 +   * PHP\Spl\
    * PHP\iter\    * PHP\iter\
    * PHP\iterable\    * PHP\iterable\
Line 277: Line 316:
    * iterable\    * iterable\
    * PHP\    * PHP\
 +   * PHP\Spl\
    * PHP\iter\    * PHP\iter\
    * PHP\iterable\    * PHP\iterable\
Line 285: Line 325:
 </doodle> </doodle>
  
-Eigth choice:+Eighth choice:
  
 <doodle title="Straw poll: Eighth favorite choice of namespace" auth="tandre" voteType="single" closed="true"> <doodle title="Straw poll: Eighth favorite choice of namespace" auth="tandre" voteType="single" closed="true">
Line 292: Line 332:
    * iterable\    * iterable\
    * PHP\    * PHP\
 +   * PHP\Spl\
    * PHP\iter\    * PHP\iter\
    * PHP\iterable\    * PHP\iterable\
Line 307: Line 348:
    * iterable\    * iterable\
    * PHP\    * PHP\
 +   * PHP\Spl\
    * PHP\iter\    * PHP\iter\
    * PHP\iterable\    * PHP\iterable\
Line 322: Line 364:
    * iterable\    * iterable\
    * PHP\    * PHP\
 +   * PHP\Spl\
    * PHP\iter\    * PHP\iter\
    * PHP\iterable\    * PHP\iterable\
Line 329: Line 372:
    * Spl\iterable\    * Spl\iterable\
 </doodle> </doodle>
 +Eleventh choice:
  
 +<doodle title="Straw poll: Eleventh favorite choice of namespace" auth="tandre" voteType="single" closed="true">
 +   * iterable_any() and iterable_all()
 +   * iter\
 +   * iterable\
 +   * PHP\
 +   * PHP\Spl\
 +   * PHP\iter\
 +   * PHP\iterable\
 +   * Ext\Spl\
 +   * Spl\
 +   * Spl\iter\
 +   * Spl\iterable\
 +</doodle>
 ===== What the functions do ===== ===== What the functions do =====
  
Line 396: Line 453:
   - https://github.com/php/php-src/pull/6053   - https://github.com/php/php-src/pull/6053
  
 +===== Changelog =====
 +
 +0.2: Switch to a vote on multiple namespaces
rfc/any_all_on_iterable_straw_poll_namespace.1610893290.txt.gz · Last modified: 2021/01/17 14:21 by tandre