On Mon, 6 Feb 2017, Nikita Popov wrote: > On Mon, Feb 6, 2017 at 6:21 PM, Fleshgrinder <p...@fleshgrinder.com> wrote: > > > First: I like namespaces in Core but here me out!
<snip> > I'm strongly against use of the PHP namespace as a blanket namespace for > bundled PHP extensions. The PHP namespace should be used only for > functionality that is actually in some way related to PHP. For example, the > php-ast extension could reasonably be namespaced as php\ast, as it provides > an AST for PHP specifically. Similarly the tokenizer extension could > reasonably be namespaced as php\tokenizer. > > Extensions which are not of this type should not live in the PHP namespace, > because they don't have anything specifically to do with php, apart from > the circumstance that they happen to be bundled at the current point in > time. Remember that extension may move from being bundled to being in PECL > and vice versa. If we decide to bundle the MongoDB extension with php, > would we rename the currently used MongoDB namespace to PHP\MongoDB? If we > decided to move it back to PECL, would the namespace go back to just > MongoDB? Or would it stay PHP\MongoDB, despite not being part of PHP > anymore? Should all new extensions be written with a PHP namespace to > account for the possibility of the extension being bundled with PHP at a > later point in time (even if there are no concrete plans to do so)? > > I would answer No to these questions. The namespace MongoDB is not, as you > say, "random", it is *meaningful*. The namespace PHP is (with the > exceptions in the first paragraph notwithstanding) meaningless and an > artifact of the distribution mechanism, a mechanism which may change over > time. I very much agree with all of this, and would like to add, that for a *long* time it has been documented that PHP owns the top-level namespace: http://php.net/manual/en/userlandnaming.rules.php In any case, a discussion to namespace any existing PHP functionality should really wait until PHP 8 - and that means, that if we decide to put Sodium in PHP 7.x, it should not be namespaced out of consistenct *no matter what the RFC result* says. cheers, Derick -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php