Stanislav Malyshev wrote:

>> Hmm, would you consider introducing a new function in the *global*
>> namespace to be a self-contained feature?  I would not, because the
> 
> Depends on the function. It it's properly prefixed and does not rely or
> disrupt anything else then yes. Otherwise, no.

But what is "properly prefixed"?  Is there a list of reserved prefixes?

>> function definition would change the global environment, possibly
>> breaking some code.
> 
> You can always invent some code that depends on exact state of the
> universe in the moment (https://xkcd.com/1172/) but let's be reasonable
> - if somebody stuck their function into intl_* or mysql_* namespace
> whatever happens next is on them.

I agree.  However, there are other "namespaces" which are not so
special, especially for beginners, for instance, array_* and str_*.  And
of course, someone might consider it to be reasonable to invent a new
function in userland which is an extension of some existing function,
therefore giving it a similar name, e.g. preg_replace_callback_array().
 Would that be considered to be bad style?  If so, where is it documented?

I'm aware that I'm nit-picking, and that the probability of such
collisions is near zero, but it is not equal to zero.

-- 
Christoph M. Becker

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to