PHP的全局命名空间 [英] PHP's global namespace
问题描述
为什么PHP的系统功能都在全局命名空间中?
与用户定义的函数冲突?
-
__________
| im | yler http://timtyler.org/ ti * @ tt1lock。组织删除锁定以回复。
Tim Tyler写道:
为什么是PHP所有系统都在全局命名空间中运行?
这不会导致混乱,因为添加了新功能,其名称与用户定义的功能相冲突?
简单:不要使用php函数作为你自己的名字。这将与任何语言冲突
!
问候
timo
Timo Henke< ti ****** @ fli7e.de>编写或引用:Tim Tyler写道:
为什么PHP的系统功能都在全局命名空间中?
这不会导致混乱,因为添加了新功能,其名称与用户定义的功能相冲突?
简单:不要使用php函数作为你自己的名字。
我在谈论添加到PHP的新函数。
避免那些显然需要预知。
我很少看到用户功能进入如此拥挤的命名空间 -
选择功能名称感觉有点像导航雷区。
这会以任何语言冲突!
其他语言不能将所有功能直接放入全局命名空间。
-
__________
| im | yler http://timtyler.org/ ti*@tt1lock.org 删除锁定进行回复。 />
Tim Tyler写道:
其他语言并没有将所有功能直接放入全局
命名空间。 / blockquote>
我认为这个问题更多地与事实名称空间arn''ta功能
of PHP有关。它们将包含在PHP5中。
亲切的问候,
-
Ian P. Christian
Why are PHP''s system functions all in a global namespace?
Won''t this lead to chaos as new functions are added, which have names
which clash with user-defined functions?
--
__________
|im |yler http://timtyler.org/ ti*@tt1lock.org Remove lock to reply.解决方案Tim Tyler wrote:
Why are PHP''s system functions all in a global namespace?
Won''t this lead to chaos as new functions are added, which have names
which clash with user-defined functions?
simple : do not use php functions as your own names. this would conflict
in ANY language!
regards
timo
Timo Henke <ti******@fli7e.de> wrote or quoted:Tim Tyler wrote:Why are PHP''s system functions all in a global namespace?
Won''t this lead to chaos as new functions are added, which have names
which clash with user-defined functions?
simple : do not use php functions as your own names.
I was talking about new functions added to PHP.
Avoiding those would apparently require precognition.
Rarely have I seen user functions going into such a crowded namespace -
picking function names feels a bit like navigating a minefield.
this would conflict in ANY language!
Other languages don''t put all their functions straight into a global namespace.
--
__________
|im |yler http://timtyler.org/ ti*@tt1lock.org Remove lock to reply.
Tim Tyler wrote:
Other languages don''t put all their functions straight into a global
namespace.
I think this issue has more to do with the fact namespaces arn''t a feature
of PHP. They will be included in PHP5.
Kind Regards,
--
Ian P. Christian
这篇关于PHP的全局命名空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!