Re: [RFC][Vote] Typed Properties

From: Date: Wed, 25 May 2016 15:56:40 +0000
Subject: Re: [RFC][Vote] Typed Properties
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-93510@lists.php.net to get a copy of this message
Hi! > * uninitialised - the constructor (or indeed, other code) is yet to set it > * null - the property is left intentionally empty For 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. > * some other value - the property is intentionally given a value > > A simple example might be a Lisp-style linked list cell: > > 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). This is a very weird list, as it can't be empty. -- Stas Malyshev smalyshev@gmail.com

« previous php.internals (#93510) next »