rfc:weakrefs

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
Last revisionBoth sides next revision
rfc:weakrefs [2018/05/17 07:55] krakjoerfc:weakrefs [2019/03/11 23:39] krakjoe
Line 3: Line 3:
   * Date: 2018-05-17   * Date: 2018-05-17
   * Author: krakjoe   * Author: krakjoe
-  * Status: Discussion+  * Status: Implemented
   * First Published at: http://wiki.php.net/rfc/weakrefs   * First Published at: http://wiki.php.net/rfc/weakrefs
  
Line 19: Line 19:
  
 ===== API ===== ===== API =====
- 
 The proposed API: The proposed API:
  
 <code php> <code php>
-class WeakRef +final class WeakReference 
-    public function __construct(object $object);+    public static function create(object $object) : WeakReference;
          
     public function get() : ?object;     public function get() : ?object;
Line 30: Line 29:
 </code> </code>
  
-The proposed API differs from the documented [[http://docs.php.net/class.weakref]] class. The currently documented API includes the following methods omitted from the proposed API:+The proposed API differs from the documented [[http://docs.php.net/class.weakref|WeakRef]] class. The currently documented API includes the following methods omitted from the proposed API:
  
   * valid   * valid
Line 37: Line 36:
  
 Acquire and release are sugar for get and unset, and valid is simply superfluous since the get method will not throw an exception and null is a falsy value. Acquire and release are sugar for get and unset, and valid is simply superfluous since the get method will not throw an exception and null is a falsy value.
 +
 +===== Implementation Details =====
 +
 +The proposed API:
 +
 +  * is closed
 +  * does not support serialization
 +  * does not support properties
 +  * supports cloning
  
 ===== Backward Incompatible Changes ===== ===== Backward Incompatible Changes =====
Line 42: Line 50:
  
 ===== Proposed PHP Version(s) ===== ===== Proposed PHP Version(s) =====
-PHP 7.3+PHP 7.4
  
 ===== RFC Impact ===== ===== RFC Impact =====
Line 68: Line 76:
 ===== Proposed Voting Choices ===== ===== Proposed Voting Choices =====
 Simple Yes/No, requires super majority. Simple Yes/No, requires super majority.
 +
 +<doodle title="Implement weakrefs ?" auth="krakjoe" voteType="single" closed="true">
 +   * Yes
 +   * No
 +</doodle>
 +
 +Voting started 2019-02-22, ends 2019-03-08.
  
 ===== Patches and Tests ===== ===== Patches and Tests =====
-https://github.com/php/php-src/pull/3237+https://github.com/php/php-src/pull/3787
  
 ===== References ===== ===== References =====
-https://externals.io/message/102111+Announce: https://externals.io/message/102111 
 + 
 +Re-announce: https://externals.io/message/104014
rfc/weakrefs.txt · Last modified: 2019/03/13 09:31 by krakjoe