Re: What's our official stance on small self-containedadditionsin a micro version
| From: | Christoph Becker | Date: | Thu, 02 Apr 2015 00:21:32 +0000 |
| Subject: | Re: What's our official stance on small self-containedadditionsin a micro version | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-85681@lists.php.net to get a copy of this message | ||
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