rfc:spl-improvements:data-structures

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:spl-improvements:data-structures [2012/01/08 06:02] – [What is wrong with the data structures?] levimrfc:spl-improvements:data-structures [2017/09/22 13:28] (current) – external edit 127.0.0.1
Line 8: Line 8:
 ===== Introduction ===== ===== Introduction =====
  
-The data structures in the SPL are flawed in many ways. +The data structures in the SPL are flawed in many ways.  See [[/rfc/spl-improvements]] for more information on the SPL.
 ===== What is wrong with the data structures? ===== ===== What is wrong with the data structures? =====
  
Line 57: Line 56:
     * **[[http://php.net/manual/en/class.splobjectstorage.php|SplObjectStorage]] violates the idea of single responsibility.**  It is performing duties as a Map and a Set.  The API is difficult to use because of this dual-identity.     * **[[http://php.net/manual/en/class.splobjectstorage.php|SplObjectStorage]] violates the idea of single responsibility.**  It is performing duties as a Map and a Set.  The API is difficult to use because of this dual-identity.
  
-    * [[http://php.net/manual/en/class.splstack.php|SplStack]] and [[http://php.net/manual/en/class.splqueue.php|SplQueue] are fully exposed [[http://php.net/manual/en/class.spldoublylinkedlist.php|SplDoublyLinkedList]]s.  This means you can use an SplStack or SplQueue just as you would use an array. This exposes too much of the implementation to the user and could be a source of bugs.+    * [[http://php.net/manual/en/class.splstack.php|SplStack]] and [[http://php.net/manual/en/class.splqueue.php|SplQueue]] are fully exposed [[http://php.net/manual/en/class.spldoublylinkedlist.php|SplDoublyLinkedList]]s.  This means you can use an SplStack or SplQueue just as you would use an array. This exposes too much of the implementation to the user and could be a source of bugs.
 ===== Proposal ===== ===== Proposal =====
  
-We fix it.+  * **SplStack and SplQueue should not publicly inherit from SplDoublyLinkedList.** 
 +  * **SplObjectStorage should be split into a Map(Dictionary) and Set.**
  
 ===== Changelog ===== ===== Changelog =====
rfc/spl-improvements/data-structures.1326002541.txt.gz · Last modified: 2017/09/22 13:28 (external edit)