PHP全局命名空间堵塞了 [英] PHP global namespace clogged up

查看:57
本文介绍了PHP全局命名空间堵塞了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

PHP将其大部分功能放入一个大的扁平全局命名空间。


导致函数名称短 - 但会为程序员创建一个命名空间

minefield 。


很多功能都是PHP前几天的遗产

获得了面向对象的功能。


例如我们目前有:


strstr(haystack,needle)


....而不是像:


haystack - >查找(针);


要清理现有的混乱,需要创建许多新函数作为相应对象的成员函数 -

和全局命名空间中的大多数旧函数需要

弃用。


有人认为现有的混乱会被清理干净吗?


或者是PHP的函数命名空间在这个阶段太强大了

有待修复吗?

-

__________

| im | yler http:// timtyler。 org / ti*@tt1lock.org 删除锁定以回复。

PHP puts most of its functions into a big flat global namespace.

That leads to short function names - but creates a namespace
minefield for programmers.

Lots of the functions are legacies from the days before PHP
got object-oriented features.

For instance we currently have:

strstr(haystack, needle)

....instead of something like:

haystack -> find(needle);

To clean up the existing mess, many new functions need to
be created as member function of the appropriate objects -
and most of the old functions in the global namespace need
deprecating.

Does anyone think the existing mess will ever get cleaned up?

Or is PHP''s function namespace too shafted at this stage to
ever be repaired?
--
__________
|im |yler http://timtyler.org/ ti*@tt1lock.org Remove lock to reply.

推荐答案

" Tim Tyler"写道:
"Tim Tyler" wrote:
PHP将其大部分功能放入一个大的扁平全局命名空间。

这会导致函数名称缩短 - 但会为程序员创建一个命名空间。

很多功能都是PHP前几天获得面向对象功能的遗产。

例如我们目前有:
strstr(haystack,needle)

....而不是像:干草堆 - >找到(针);

要清理现有的混乱,需要创建许多新功能作为相应对象的成员函数 -
和大多数旧函数在全局命名空间需要
弃用。

有没有人认为现有的混乱会被清理干净?

或者是PHP的函数命名空间在这个阶段太强大了要修好吗?
PHP puts most of its functions into a big flat global namespace.

That leads to short function names - but creates a namespace
minefield for programmers.

Lots of the functions are legacies from the days before PHP
got object-oriented features.

For instance we currently have:

strstr(haystack, needle)

....instead of something like:

haystack -> find(needle);

To clean up the existing mess, many new functions need to
be created as member function of the appropriate objects -
and most of the old functions in the global namespace need
deprecating.

Does anyone think the existing mess will ever get cleaned up?

Or is PHP?s function namespace too shafted at this stage to
ever be repaired?




我认为你有一个有效的观点。但是,由于存在巨大的遗留代码库,旧功能无法轻易退役。那么

问题就变成了,我们可以有两套功能。


-
http://www.dbForumz.com/ 本文由作者的请求发表

文章单独检查是否符合usenet标准

主题网址: http://www.dbForumz.com/PHP-global-n...ict145545.html

访问主题网址以联系作者(reg.req' D)。举报滥用行为: http://www.dbForumz.com/eform.php ?p = 487021



I think you have a valid point. However, the old functions cannot
easily be retired due enormous legacy code base out there. So the
question then becomes, can we have two sets of functions.

--
http://www.dbForumz.com/ This article was posted by author''s request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/PHP-global-n...ict145545.html
Visit Topic URL to contact author (reg. req''d). Report abuse: http://www.dbForumz.com/eform.php?p=487021


***steveescribió/写(2004年9月1日16:02:51 -0400):
*** steve escribió/wrote (1 Sep 2004 16:02:51 -0400):
我认为你有一个有效的观点。但是,由于存在巨大的遗留代码库,旧功能无法轻易退役。那么
问题就变成了,我们可以有两套功能。
I think you have a valid point. However, the old functions cannot
easily be retired due enormous legacy code base out there. So the
question then becomes, can we have two sets of functions.




我不确定原始海报的含义。我们应该更换......



I''m not sure of what the original poster meant. Should we replace...


a = trim(


这篇关于PHP全局命名空间堵塞了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆