Re: [PHP-DEV] [RFC][DISCUSSION] PHP Namespace in core

This is only part of a thread. view whole thread
  109716
April 20, 2020 12:06 kontakt@beberlei.de (Benjamin Eberlei)
Hi Michał, George,

On Wed, Apr 15, 2020 at 2:29 PM Michał Brzuchalski <
michal.brzuchalski@gmail.com> wrote:

> Hi internals, > > I hope you're doing well. > > I'd like to announce the PHP Namespace in core RFC for discussion. > The RFC is authored by me together with George Peter Banyard and it's > purpose > is nothing more like to allow the use of PHP Namespace in the core. > > The RFC is described at https://wiki.php.net/rfc/php-namespace-in-core
I think the php namespace for core is important to have, especially for features that have more than a single, but multiple classes, grouping them in a PHP internal namespace will be helpful to avoid weird prefixing. With the Attributes RFC in mind, an earlier draft has used the namespace PHP\Attributes that a few contributors rightly mentioned is a bad idea without project wide standardization first. For my taste, the RFC is great except the "A chance to clean up poor design/naming decisions" section. It goes into politics and controversial ideas that essentially are outside the scope of the RFC itself. So while SPL and Reflection would benefit if we had the namespace before those APIs, I am not sure they drive down the point of why we need this: a.) Instead of changing SPL I believe most would pretty much agree that we just need a complete replacement with a better API (pointing towards phpds here might be a better example) b.) Moving some new parts of Reflection into the namespace while keeping others in the main namespace is extremely confusing, and we shouldn't confuse users that way. Realistically this is an issue thats not going to be changed. I do like the Frame example, similar to token_get_all returning an array, debug_backtrace could benefit from an object based representation. I would reluctantly call it a "toy example", it is an actual example or not? greetings Benjamin
> > > Best Regards, > Michał Brzuchalski >
  109739
April 21, 2020 05:29 mike@newclarity.net (Mike Schinkel)
I have been wondering for a while why PHP does not officially recognize a \PHP namespace.

The inconsistency people have mentioned feels like a fair tradeoff for allowing new core classes to be cleanly-named and easier to understand.

And a \PHP namespace would allow RFCs to never need worry about conflicting with userland class names again.  

The one thing I would ask the authors: 

- Why limit it to "tightly coupled to the PHP engine?" 
- Why not just say "any new core classes that are approved to use it?"

After all, sometimes a namespace is just a namespace. Seems like a winner to me.

-Mike
  109740
April 21, 2020 07:19 michal.brzuchalski@gmail.com (=?UTF-8?Q?Micha=C5=82_Brzuchalski?=)
Hi Mike

wt., 21 kwi 2020 o 07:29 Mike Schinkel <mike@newclarity.net> napisał(a):

> I have been wondering for a while why PHP does not officially recognize a > \PHP namespace. > > The inconsistency people have mentioned feels like a fair tradeoff for > allowing new core classes to be cleanly-named and easier to understand. > > And a \PHP namespace would allow RFCs to never need worry about > conflicting with userland class names again. > > The one thing I would ask the authors: > > - Why limit it to "tightly coupled to the PHP engine?" > - Why not just say "any new core classes that are approved to use it?"
In the past, there were some proposals which treated about core namespace proposing to include most of the core symbols in a structured way. These proposals always failed for some reason. This proposal tries to convince internals to use PHP namespace in the core for tightly coupled to the PHP engine types which could be placed there without a risk to be unbundled in a future what would cause a need to rename them back. Therefore we think that these along with the arguments in the proposal are the best ones to agree for now. BR, Michał Brzuchalski
  109741
April 21, 2020 07:31 michal.brzuchalski@gmail.com (=?UTF-8?Q?Micha=C5=82_Brzuchalski?=)
Hi Benjamin,

pon., 20 kwi 2020 o 14:06 Benjamin Eberlei <kontakt@beberlei.de> napisał(a):

> Hi Michał, George, > > On Wed, Apr 15, 2020 at 2:29 PM Michał Brzuchalski < > michal.brzuchalski@gmail.com> wrote: > >> Hi internals, >> >> I hope you're doing well. >> >> I'd like to announce the PHP Namespace in core RFC for discussion. >> The RFC is authored by me together with George Peter Banyard and it's >> purpose >> is nothing more like to allow the use of PHP Namespace in the core. >> >> The RFC is described at https://wiki.php.net/rfc/php-namespace-in-core > > > I think the php namespace for core is important to have, especially for > features that have more than a single, but multiple classes, grouping them > in a PHP internal namespace will be helpful to avoid weird prefixing. > > With the Attributes RFC in mind, an earlier draft has used the namespace > PHP\Attributes that a few contributors rightly mentioned is a bad idea > without project wide standardization first. > > For my taste, the RFC is great except the "A chance to clean up poor > design/naming decisions" section. It goes into politics and controversial > ideas that essentially are outside the scope of the RFC itself. So while > SPL and Reflection would benefit if we had the namespace before those APIs, > I am not sure they drive down the point of why we need this: > > a.) Instead of changing SPL I believe most would pretty much agree that we > just need a complete replacement with a better API (pointing towards phpds > here might be a better example) > b.) Moving some new parts of Reflection into the namespace while keeping > others in the main namespace is extremely confusing, and we shouldn't > confuse users that way. Realistically this is an issue thats not going to > be changed. > > I do like the Frame example, similar to token_get_all returning an array, > debug_backtrace could benefit from an object based representation. I would > reluctantly call it a "toy example", it is an actual example or not? >
The example with the Frame is something I'm thinking about to propose and implement. About the changing SPL. Bear in mind that the current proposal is only about an agreement to allow the use of PHP namespace in the core. @Benjamin: You suggest to skip the examples and arguments regarding poor design/naming decisions with Reflection API ? Those examples are put in the RFC to help understand the argumentation and the result of this RFC should be the agreement that any future RFC proposing an introduction of the tightly coupled with the PHP engine symbol (and to mention the ones with PhpToken and PhpAttribute and family could be perfect candidates) should not worry for the proposal to be rejected because of the use of PHP namespace in core symbols. BR, Michał Brzuchalski
  109808
April 23, 2020 12:16 george.banyard@gmail.com ("G. P. B.")
Hello everyone,

We've updated the RFC [1] by rewriting it in part and trying to add more
details
/context and trying to address some other concerns which came up.

Hoping for some more feedback before planning on moving this to a vote.

Best regards

George P. Banyard

[1] https://wiki.php.net/rfc/php-namespace-in-core