Re: Reviving scalar type hints
| From: | Zeev Suraski | Date: | Fri, 20 Feb 2015 15:24:43 +0000 |
| Subject: | Re: Reviving scalar type hints | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-83310@lists.php.net to get a copy of this message | ||
> On 20 בפבר׳ 2015, at 16:55, Anthony Ferrara <ircmaxell@gmail.com> wrote:
>
> verification and static analysis aren't enough?
>
Anthony,
While IMHO they're not enough to warrant substantial deviation from PHP's behavior, this
is a subjective question that others might answer differently.
But there's also an objective issue. There's a serious question mark whether the type of
hint - strict, coercive of otherwise can have any sort of implications on one's ability to
conduct static analysis, JIT or AOT (I'm bringing those up again since they're closely
related in terms of what you can or cannot infer).
Now, I'll contend that even though I don't think we are, perhaps we're missing
something. But at the very least it should be clear to the list there's serious doubt on
whether there's any extra value there even if they do seem static analysis critical. If there
is, it's likely to be very, very limited in scope.
> That's not saying you should want to use statically typed for
> everything. And nor would I support PHP moving to pure statically
> typed (which is why the proposal I'm backing doesn't).
We're on the same page here. But the kinds of static analysis benefits you seem to believe we
can get from strict type hints would require that - strong typing, variable declarations, perhaps
changes to casting rules - not just around that narrow interface between callers and callees.
Thankfully that's not on the table.
Thanks,
Zeev