AW: [PHP-DEV] JIT (was RE: [PHP-DEV] Coercive Scalar Type Hints RFC)
| From: | Robert Stoll | Date: | Mon, 23 Feb 2015 08:27:26 +0000 |
| Subject: | AW: [PHP-DEV] JIT (was RE: [PHP-DEV] Coercive Scalar Type Hints RFC) | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-83550@lists.php.net to get a copy of this message | ||
Hey all,
tl;dr
Just one point which JIT/AOT people should consider when dealing with PHP. PHP is highly dynamic and
there are enough use cases which makes it impossible for a static analyser to infer types accurately
without using a top type like mixed.
How would you deal with variable function calls, variable variables, reflection, dynamic includes
etc.
Your inferred types would simply be wrong without using mixed. Consider the following
function foo(int $a){}
$a = 1; //can be int for sure right?
$b = "a";
$$b = "h"; //oh no, your generated code would crash
foo($a);
Maybe I am wrong and there is a possibility, if so, please let me know, would be interesting to
know.
Cheers,
Robert