On Wed, 15 Apr 2020 at 19:24, Andrea Faulds <a...@ajf.me> wrote:

> Hi,
>
> Michał Brzuchalski wrote:
> > Hi Marcio,
> >
> > śr., 15 kwi 2020 o 18:39 Marcio Almada <marcio.w...@gmail.com>
> napisał(a):
> >
> >> Even though I'm fond to the idea of languages having the official
> >> stdlib contained
> >> into a single space, there seems to be no practicality on a \PHP
> namespace
> >> usage
> >> at this point IMMO.
> >>
> >> We would be in a situation where things are either mixed in and out
> >> the new namespace
> >> - Should I `use function PHP\{json_encode, json_decode}` or was it in
> >> the root??? - or
> >> everything that already exists must first receive an alias into this
> >> new namespace, to allow
> >> consistency... but then there would probably be no plans ever to
> >> actually move existing stuff
> >> into the new prefix in the future.
> >>
> >>
> > You've misunderstood the idea. Standard library functions classes etc.
> are
> > not language features.
> > It's not a purpose of this RFC to move existing functions from the
> standard
> > library but to allow core language features
> > to use it. Described examples show benefit in use for symbols tightly
> > coupled to features PHP as a language delivers.
> >
> > Most of the standard library function can be replaced by implementations
> in
> > PHP or by wrapping around a C library.
> > The features tightly coupled with the language is for eg. the Reflection
> > mechanism, PhpToken class as described.
> > Upcoming PhpAttributes for which proposal is a work in progress.
> >
> > Those all features will not likely be moved to PECL and this RFC proposal
> > is to allow features like that to use PHP namespace.
>
> We already have PHP language features relying on classes in the root
> namespace (Closure, Throwable, ArrayAccess, etc) so the point Marcio
> makes about inconsistency is nonetheless valid I think.
>
> Thanks,
> Andrea
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>

The proposal is not to move everything into the PHP namespace.
I would even argue that these interface make more sense in the global
namespace as they are meant to be available to all users to implement
and extend.

This is in strong contract to the Reflection API which, at least, should not
be extended by end users IMHO as it provided features which are heavily
tied to the engine and how it is implemented.
Now as Reflection is already an existing feature the objective here is not
to move the current one into the PHP namespace and alias it but possibly
provide a Reflection 2.0 API which is design with the benefit of hindsight.

A more relevant example, in my eyes, is the current proposal of attributes.
Engine attributes like JIT, NoJIT, and possibly in the future Deprecated
and/
or Final are features provided by the engine which should not have the
possibility to be extended by end users, only consumed.

Another example I can come up are scalar objects.
If PHP starts to provided scalar objects, I would imagine that they it won't
be possible to extend them and only consume them, in the same way as
the current functions provided by ext/standard.
Or maybe a new API to interact with stream and/or the file system.

I hope this clarifies the intent behind the RFC.

Best regards

George P. Banyard

Reply via email to