Ask a Question related to PHP Development, Design and Development.
-
Tim Tyler #1
PHP's global namespace
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 [url]http://timtyler.org/[/url] [email]tim@tt1lock.org[/email] Remove lock to reply.
Tim Tyler Guest
-
How do I keep individual .php's from being posted
My DW operator left the company and I need to remove her from the website. I do not want to delete her PHP though. I can see other ex-employees in... -
Is there a Coldfusion equivalent to PHP's array_unique?
I'm trying to filter out unique array elements in Coldfusion MX 7. Is there any coldfusion function equivalent to PHP's array_unique function? ... -
IPTables namespace - how to commandeer namespace
I have a Perl module, IPTables::IPv4, that I've been developing for some time, and that is in the CPAN repository. I've expanded the module to... -
Something like PHP's PEAR::DB_NestedSet?
This PHP module looks cool: http://pear.php.net/package/DB_NestedSet is there something like it in CPAN? -- dave -
PHP's References
I'm trying to create a stack of class objects; but on cycling through them with 'foreach' I am unable to update their properties. What is the... -
Timo Henke #2
Re: PHP's global namespace
Tim Tyler wrote:
simple : do not use php functions as your own names. this would conflict> 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?
in ANY language!
regards
timo
Timo Henke Guest
-
Tim Tyler #3
Re: PHP's global namespace
Timo Henke <timonews@fli7e.de> wrote or quoted:
> Tim Tyler wrote:I was talking about new functions added to PHP.>>> 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.
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.
Other languages don't put all their functions straight into a global namespace.> this would conflict in ANY language!
--
__________
|im |yler [url]http://timtyler.org/[/url] [email]tim@tt1lock.org[/email] Remove lock to reply.
Tim Tyler Guest
-
Ian P. Christian #4
Re: PHP's global namespace
Tim Tyler wrote:
I think this issue has more to do with the fact namespaces arn't a feature> Other languages don't put all their functions straight into a global
> namespace.
of PHP. They will be included in PHP5.
Kind Regards,
--
Ian P. Christian
Ian P. Christian Guest
-
Andy Hassall #5
Re: PHP's global namespace
On Sat, 18 Oct 2003 11:30:30 +0100, "Ian P. Christian" <pookey@pookey.co.uk>
wrote:
The last I heard the developers changed their minds on that, and they're not>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.
going to be implemented.
Which is a big shame, because name clashes are inevitable once there's enough
people working on a PHP project, or you use several libraries in one script.
[url]http://news.php.net/article.php?group=php.internals&article=2124[/url]
Hopefully they will, or already have, reversed that decision.
--
Andy Hassall (andy@andyh.co.uk) icq(5747695) ([url]http://www.andyh.co.uk[/url])
Space: disk usage analysis tool ([url]http://www.andyhsoftware.co.uk/space[/url])
Andy Hassall Guest
-
Ian P. Christian #6
Re: PHP's global namespace
Andy Hassall wrote:
Oh, that is a shame :(> On Sat, 18 Oct 2003 11:30:30 +0100, "Ian P. Christian"
> <pookey@pookey.co.uk> wrote:
>>>>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.
> The last I heard the developers changed their minds on that, and they're
> not
> going to be implemented.
>
> Which is a big shame, because name clashes are inevitable once there's
> enough
> people working on a PHP project, or you use several libraries in one
> script.
I personally use classes though to provide namespaceish functionality.
Auth::getAuth(); etc. etc.
Kind Regards,
--
Ian P. Christian
Ian P. Christian Guest
-
André Nęss #7
Re: PHP's global namespace
Tim Tyler:
In my 4 years of PHP experience this has not been a problem for me. I can't> Timo Henke <timonews@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.
remember ever being bothered by this feature of PHP. It's seems like a
terrible idea, but it doesn't really work that bad.
André Nęss
André Nęss Guest
-
Keith Bowes #8
Re: PHP's global namespace
Tim Tyler wrote:
Functions typically have a library prefix to get around this:> 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?
array_sort()
preg_replace()
..
..
..
It would be nice if this convention were refined and the old functions
would be removed in PHP 5.
Keith Bowes Guest
-
Phil Roberts #9
Re: PHP's global namespace
With total disregard for any kind of safety measures Keith Bowes
<do.not@spam.me> leapt forth and uttered:
Or at least a series of function aliases put in place that define a> It would be nice if this convention were refined and the old
> functions would be removed in PHP 5.
>
proper naming standard whilst maintaining a certain degree of
backwards-compatibility.
I don't see why this would cause noticable overhead. Many existing
functions already have more than one name.
--
There is no signature.....
Phil Roberts Guest
-
Nikolai Chuvakhin #10
Re: PHP's global namespace
Tim Tyler <tim@tt1lock.org> wrote in message
news:<HMy4KL.HIM@bath.ac.uk>...Because there is no concept of namespace in PHP, I believe.>
> Why are PHP's system functions all in a global namespace?
Highly unlikely, especially given the fact that all functions> Won't this lead to chaos as new functions are added, which
> have names which clash with user-defined functions?
added after a certain point are prefixed with their extension
name (imap_*, ldap_*, mysql_*, etc.). If you are concerned
with namespace issues, you might as well adopt a similar
approach and prefix all your functions in a similar fashion.
Cheers,
NC
Nikolai Chuvakhin Guest
-
Tim Tyler #11
Re: PHP's global namespace
Nikolai Chuvakhin <nc@iname.com> wrote or quoted:
Namespaces via a naming convention seems like a hack to me.> If you are concerned with namespace issues, you might as well adopt a
> similar approach and prefix all your functions in a similar fashion.
For one thing, it fails to make referring to things in your
"own" namespace any easier.
Wouldn't it be better to use classes for this purpose?
--
__________
|im |yler [url]http://timtyler.org/[/url] [email]tim@tt1lock.org[/email] Remove lock to reply.
Tim Tyler Guest
-
Nikolai Chuvakhin #12
Re: PHP's global namespace
Tim Tyler <tim@tt1lock.org> wrote in message
news:<Hn00CC.LHs@bath.ac.uk>...But it's an easy one; that's what counts in a language that, above all,> Nikolai Chuvakhin <nc@iname.com> wrote or quoted:
>>> > If you are concerned with namespace issues, you might as well adopt a
> > similar approach and prefix all your functions in a similar fashion.
> Namespaces via a naming convention seems like a hack to me.
is supposed to be simple.
This is by and large a matter of personal taste. You want your> For one thing, it fails to make referring to things in your
> "own" namespace any easier.
own namespace because having it makes you feel more comfortable.
I don't want my own namespace because having it makes me feel
less comfortable.
To some people, yes. To an old-fashioned procedural type like yours> Wouldn't it be better to use classes for this purpose?
truly, it's an unnecessary and potentially wasteful hassle.
Cheers,
NC
Nikolai Chuvakhin Guest



Reply With Quote

