rfc:weakrefs
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
rfc:weakrefs [2018/05/17 07:17] – krakjoe | rfc:weakrefs [2019/03/11 23:39] – krakjoe | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2018-05-17 | * Date: 2018-05-17 | ||
* Author: krakjoe | * Author: krakjoe | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
Line 11: | Line 11: | ||
The current implementations of WeakRef all work by overloading object handlers, the most popular implementation ([[https:// | The current implementations of WeakRef all work by overloading object handlers, the most popular implementation ([[https:// | ||
- | Other implementations are possible, [[https:// | + | Other implementations are possible, [[https:// |
In principle weak referencing an object is not complicated, | In principle weak referencing an object is not complicated, | ||
Line 17: | Line 17: | ||
===== Proposal ===== | ===== Proposal ===== | ||
We directly support weak referencing in the simplest possible way. | We directly support weak referencing in the simplest possible way. | ||
+ | |||
+ | ===== API ===== | ||
+ | The proposed API: | ||
+ | |||
+ | <code php> | ||
+ | final class WeakReference { | ||
+ | public static function create(object $object) : WeakReference; | ||
+ | | ||
+ | public function get() : ?object; | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | The proposed API differs from the documented [[http:// | ||
+ | |||
+ | * valid | ||
+ | * acquire | ||
+ | * release | ||
+ | |||
+ | 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 22: | Line 50: | ||
===== Proposed PHP Version(s) ===== | ===== Proposed PHP Version(s) ===== | ||
- | PHP 7.3 | + | PHP 7.4 |
===== RFC Impact ===== | ===== RFC Impact ===== | ||
Line 48: | Line 76: | ||
===== Proposed Voting Choices ===== | ===== Proposed Voting Choices ===== | ||
Simple Yes/No, requires super majority. | Simple Yes/No, requires super majority. | ||
+ | |||
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
+ | |||
+ | Voting started 2019-02-22, ends 2019-03-08. | ||
===== Patches and Tests ===== | ===== Patches and Tests ===== | ||
- | https:// | + | https:// |
===== References ===== | ===== References ===== | ||
- | https:// | + | Announce: |
+ | |||
+ | Re-announce: |
rfc/weakrefs.txt · Last modified: 2019/03/13 09:31 by krakjoe