rfc:weak_maps

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:weak_maps [2019/11/04 21:06] – typos nikicrfc:weak_maps [2020/01/03 09:56] (current) – Implemented nikic
Line 3: Line 3:
   * Author: Nikita Popov <nikic@php.net>   * Author: Nikita Popov <nikic@php.net>
   * Proposed Version: PHP 8.0   * Proposed Version: PHP 8.0
-  * Status: Under Discussion+  * Status: Implemented
   * Implementation: https://github.com/php/php-src/pull/4882   * Implementation: https://github.com/php/php-src/pull/4882
  
Line 83: Line 83:
 ===== Vote ===== ===== Vote =====
  
-Add WeakMap class in PHP 8.0? Yes/No.+Voting started 2019-12-18 and closes 2020-01-01. 
 + 
 +<doodle title="Add WeakMap class in PHP 8.0?" auth="nikic" voteType="single" closed="true"> 
 +   Yes 
 +   No 
 +</doodle>
  
 ===== Differences to spl_object_id() and WeakReference ===== ===== Differences to spl_object_id() and WeakReference =====
Line 114: Line 119:
 </PHP> </PHP>
  
-This makes use of the ''WeakReference'' to determine whether the object ID has been reused. However, this does not solve the third problem: The data will not be released when the object is destroyed. It will only be released on the next access, or if a garbage collection mechanism for the map is implement, which performs regular sweeps of the whole map.+This makes use of the ''WeakReference'' to determine whether the object ID has been reused. However, this does not solve the third problem: The data will not be released when the object is destroyed. It will only be released on the next access with an object that has the same reused ID, or if a garbage collection mechanism, which performs regular sweeps of the whole map, is implemented. 
 + 
 +A native weak map implementation will instead remove the value from the weak map as soon as the object key is destroyed.
rfc/weak_maps.1572901585.txt.gz · Last modified: 2019/11/04 21:06 by nikic