Re: [RFC][Vote] Typed Properties
| From: | Andrea Faulds | Date: | Wed, 25 May 2016 16:03:27 +0000 |
| Subject: | Re: [RFC][Vote] Typed Properties | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-93512@lists.php.net to get a copy of this message | ||
Hi Stas,
Stanislav Malyshev wrote:
Hi!It'd be a BC break if we changed untyped properties' behaviour, yeah. We wouldn't be inventing a new null, though, we'd be leaving the property undefined until it's initialised, which we already have support for (properties, and indeed all variables can be unset()).* uninitialised - the constructor (or indeed, other code) is yet to set it * null - the property is left intentionally emptyFor declared properties, this always has been the same, and I'm not sure why would we want to change that. This also has a potential to be a huge BC break if we change it not to be the same, since pretty much all the code assumes it is the same. We'd essentially have to invent another null, which is exactly the same as null but isn't null. I don't see a reason to do this.
The empty list is represented by null in this arrangement. Thanks. -- Andrea Faulds https://ajf.me/* some other value - the property is intentionally given a value A simple example might be a Lisp-style linked list cell:This is a very weird list, as it can't be empty.class LinkedList { public int $head; public ?LinkedList $tail; }In a properly initialised LinkedList, the $head is some value, and the $tail is either another linked list (the remainder of the list), or null (we're at the end of the list).