Why is Importing a PHP Function into the Current Namespace Unsupported

可紊 提交于 2019-12-05 11:17:14

I contacted Jochem Maas (the author of this five year old RFC), and while he was hesitant to pin point a single reason (understandably, as he isn't currently deeply involved with the namespace system), his three factors were

  1. Class name collisions were more of a real world problem than function name collisions

  2. PHP functions and classes live in different areas of the engine code, and there were technical hurdles to parsing out which was which during a use statement.

  3. There was some uncertainty/difference of opinion on how to handle the autoloader and the importing/aliasing of specific functions. (The autoloader, a separate system, works with classes only)

In the end, PHP's pragmatism won out, and that's why we have the namespace system we have today.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!