Re: Re: Typed properties patch

From: Date: Wed, 13 Apr 2016 19:31:25 +0000
Subject: Re: Re: Typed properties patch
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-92259@lists.php.net to get a copy of this message
Hi! > Because if you unset() a property it's type is not guaranteed anymore. Can't we fix it? I mean, when we unset property on an object, we're still keeping the definition in the class, right? Can't we use it? > > <?php > class Foo () { > int $a = 0; > } > $a = new Foo(); > $b = $a->x + 5; /* we know $a->x is "int" and may use optimized code */ > unset($a->x); > $b = $a->x + 5; /* $a->x is not "int" any more and we can't use > optimized code */ Can't we assume $a->x is still "int" here in a way - I mean, we'd still have to allow for the possibility of null, but if we say that any one could be null it's just one easy check, so it won't hurt performance too much, not? -- Stas Malyshev smalyshev@gmail.com

« previous php.internals (#92259) next »