Re: Non-nullable properties

From: Date: Mon, 16 Jul 2018 16:53:29 +0000
Subject: Re: Non-nullable properties
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-102861@lists.php.net to get a copy of this message
On 16 July 2018 at 17:24, Wes <netmo.php@gmail.com> wrote: > It's more strict in the proposed rfc. In particular in java the error is > allowed to propagate in the program, while here it won't be. > In other words if $foo->aaa is uninitialized, you are not > allowed to > do $baz->bbb = $foo->aaa. > In java that's allowed, so in java null pointer deref can really happen > anywhere without knowing its origin, and that's really a big problem. > >> > Ah, yes, point taken. I'd overlooked the possibility of copying the reference without dereferencing it. That is indeed worse. Although the ability to pass around, duplicate, and manipulate an object in various ways and then suddenly get an error that should have been thrown in the constructor, is still pretty unhelpful. Regards, -- Rowan Collins [IMSoP]

« previous php.internals (#102861) next »