为什么php编译器(HPHP)的动态结构很难?

bla*_*e24 8 php compiler-construction compilation

我正在阅读Paul Bigger的http://blog.paulbiggar.com/archive/a-rant-about-php-compilers-in-general-and-hiphop-in-particular/,他提到HPHP并不完全支持动态结构.然后他说:"不过,一个天真的方法就是坚持使用switch语句,编译所有有意义的东西." 他是说可以使用switch语句来包含正确的文件而不是动态包含吗?如果是这样,为什么这会起作用,为什么编译器"更容易"编译?一如既往,你的时间!

use*_*291 2

据我了解,如果你有这个

 include "$foo.php";
Run Code Online (Sandbox Code Playgroud)

编译器不知道你要包含什么。另一边,有了这个

  switch($foo) {
     case 'bar'  : include "bar.php";
     case 'quux' : include "quux.php";
  }
Run Code Online (Sandbox Code Playgroud)

他们可以简单地编译“bar”和“quux”并将它们包装在 if 语句中,该语句检查$foo并执行任何适当的内容。