rfc:array_group

Differences

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

Link to this comparison view

Next revision
Previous revision
rfc:array_group [2023/06/01 00:02] – created bor0rfc:array_group [2023/06/01 00:16] (current) bor0
Line 12: Line 12:
 Almost all mainstream programming languages have a built-in grouping functionality: Almost all mainstream programming languages have a built-in grouping functionality:
  
-  * [[https://www.scala-lang.org/api/2.12.4/scala/collection/parallel/ParIterableLike$GroupBy.html|Scala]]+  * [[https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.groupby?view=net-7.0|.NET]]
   * [[https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/group|JavaScript]]   * [[https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/group|JavaScript]]
 +  * [[https://docs.oracle.com/javase/8/docs/api/java/util/stream/Collectors.html#groupingBy-java.util.function.Function-|Java]]
 +  * [[https://www.scala-lang.org/api/2.12.4/scala/collection/parallel/ParIterableLike$GroupBy.html|Scala]]
   * [[https://hackage.haskell.org/package/groupBy-0.1.0.0/docs/Data-List-GroupBy.html|Haskell]]   * [[https://hackage.haskell.org/package/groupBy-0.1.0.0/docs/Data-List-GroupBy.html|Haskell]]
-  * [[https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.groupby?view=net-7.0|.NET]] 
  
 The way this has been approached in PHP in the past was to just implement a custom function and use it. This has several drawbacks: The way this has been approached in PHP in the past was to just implement a custom function and use it. This has several drawbacks:
Line 57: Line 58:
  
 ===== Backward Incompatible Changes ===== ===== Backward Incompatible Changes =====
-Similarly to introducing any other function, this could cause breakages in codebases where the functions ''array_group'' or ''array_group_pair'' are redefined, in which case the user would receive the "Cannot redeclare function" error.+Similarly to introducing any other new function to PHP, this could cause breakages in codebases where the functions ''array_group'' or ''array_group_pair'' are defined, in which case the user would receive the "Cannot redeclare function" error.
  
-Doing a quick GitHub search for [[array_group|https://github.com/search?q=array_group+lang%3Aphp&type=code]] shows about 1k such functions, and 0 functions for [[array_group_pair|https://github.com/search?q=array_group_pair+lang%3Aphp&type=code]].+Doing a quick GitHub search for [[https://github.com/search?q=array_group+lang%3Aphp&type=code|array_group]] shows about 1k such functions, and 0 functions for [[https://github.com/search?q=array_group_pair+lang%3Aphp&type=code|array_group_pair]].
  
 ===== Proposed PHP Version(s) ===== ===== Proposed PHP Version(s) =====
rfc/array_group.1685577778.txt.gz · Last modified: 2023/06/01 00:02 by bor0