Re: Consensus Gathering: is_initialized

From: Date: Wed, 26 May 2021 13:24:38 +0000
Subject: Re: Consensus Gathering: is_initialized
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-114619@lists.php.net to get a copy of this message
On 26/05/2021 11:13, Joe Watkins wrote:
Hi internals, In response to: https://bugs.php.net/bug.php?id=78480 I implemented: https://github.com/php/php-src/pull/7029
My general feeling remains that the "uninitialized" state is an awkward hack that we should be working to eliminate with better constructor semantics. A variable that remains uninitialised after the constructor almost always indicates a bug in the constructor, not a state that the rest of the application should care about. On the other hand, we have already allowed unset() to produce this special state, with defined behaviour for __get, so possibly the genie's out of the bottle, and we have to embrace it as a new "type". On the gripping hand, this is likely to lead to even more confusion about what exactly the different states are: properties declared with a type, properties declared without a type, properties not declared at all; all of which can be null, a non-null value, or completely unset. People already complain that isset() returns false for null variables (I disagree, but...); this function could end up even harder to explain. Regards, -- Rowan Tommins [IMSoP]

« previous php.internals (#114619) next »