Re: AW: [PHP-DEV] PHP7 and types
| From: | Rasmus Lerdorf | Date: | Mon, 13 Jul 2015 07:40:52 +0000 |
| Subject: | Re: AW: [PHP-DEV] PHP7 and types | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-87132@lists.php.net to get a copy of this message | ||
On 07/13/2015 12:16 AM, Robert Stoll wrote:
> Another point of discussion should be how strict a property type hint will be. Currently,
> parameter type hints are only binding for the call side but not within the function body.
> For instance, function foo(Foo $x){ $x = 1;} is perfectly valid. It certainly has little sense
> to have the same semantics for properties but then we introduce another inconsistency and should
> maybe fix the behaviour of parameter type hints first.
Like I said, adding type checks to every assignment is a rather large
change, and I doubt it can be done without some nasty performance costs.
Honestly, I would rather have a speedy runtime and put the effort into a
static analysis mode built into PHP. The stated goal of so many who push
the strict types everywhere argument is that it helps find bugs. So
let's have an analyze mode that finds these bugs without bogging down
the runtime with thousands of type checks.
-Rasmus
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc