On 04/13/2016 07:33 AM, Stanislav Malyshev wrote:
Hi!
Thanks for your time reviewing the patch, appreciated.
> 1) nullable properties
I agree that we need a way to that, but I would rather see it
covered by nullable types rfc.
I think this is an attempt to achieve more type safety than even fully
typed languages like Java, and it will only get in the way in PHP.
> 3) disable unset
This sounds very weird. Why I would suddenly unable to unset a property?
Because if you unset() a property it's type is not guaranteed anymore.
<?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 */
?>
As we can't be sure where the property may be unset(), we won't be able
to use optimized code at all (even in first place).
Thanks. Dmitry.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php