Re: Question about adding !function_identifier
| From: | Rowan Collins | Date: | Fri, 05 Apr 2019 13:27:27 +0000 |
| Subject: | Re: Question about adding !function_identifier | ||
| 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-105110@lists.php.net to get a copy of this message | ||
On Fri, 5 Apr 2019 at 14:05, Robert Hickman <robehickman@gmail.com> wrote:
> > I think you're misunderstanding the problem: it's not that the
> *programmer* doesn't know the types, it's that the *analysis tool* doesn't
> know them, because the programmer hasn't told it, and currently has no way
> to tell it.
> >
>
> If the static analyser was programmable, it would be possible to
> provide it such information, within the scope of a single code base.
>
I'm not really sure what you're suggesting; the normal way to "program" a
static analyzer is to add more and richer type annotations to your code, as
in the over-the-top example I gave (in reality, the analyser can deduce
some of the types, and the syntax needn't be quite that ugly).
The problem is that PHP has a lot of features where there is currently no
way to specify types (callbacks, iterators, etc), and some where it's
essentially impossible to do so in a checkable way ($$foo, $foo->$bar, etc).
I'm not saying it's not possible, it's just a considerable project to
rewrite a dynamic language into a statically typed one, and at the moment
Hack is much further into that project than PHP, partly because it has less
concern about backwards compatibility.
Regards,
--
Rowan Collins
[IMSoP]