Re: Request for RFC Karma: "use-from syntax for namespace use declarations"
| From: | Ben Ramsey | Date: | Tue, 06 Jan 2026 04:20:40 +0000 |
| Subject: | Re: Request for RFC Karma: "use-from syntax for namespace use declarations" | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-129739@lists.php.net to get a copy of this message | ||
On Mon, Jan 5, 2026 at 17:28 Ilija Tovilo <tovilo.ilija@gmail.com> wrote:
> Hi Stuardo
>
> Sorry for the late reply.
>
> On Tue, Dec 30, 2025 at 5:25 PM Stuardo -StR- Rodríguez <str@maphpia.com>
> wrote:
> >
> > My name is Stuardo Rodríguez, and I would like to request RFC karma to
> publish an RFC on the PHP wiki.
>
> RFC karma was granted. Good luck!
>
> > I have prepared an RFC titled "use-from syntax for namespace use
> declarations" which proposes an alternative
use syntax
> that improves
> readability by placing imported symbols first, followed by a namespace
> prefix introduced by from.
> >
> > Example:
> > ```php
> > use ClassA from Vendor\Package;
> > use {ClassB, ClassC as C} from Vendor\Package;
> > ```
> >
> > This is syntax sugar equivalent to existing imports:
> > ```php
> > use Vendor\Package\ClassA;
> > use Vendor\Package\{ClassB, ClassC as C};
> > ```
>
> I think such a proposal will have a very hard time passing. The
> existing syntax is obviously well established as it has existed for
> almost two decades. The alternative syntax doesn't immediately seem
> better, other than being different (and probably closer to JS).
>
> You'd need to make a strong case about why this new syntax is
> necessary (though I don't personally believe there is one).
>
> Regards,
> Ilija
Another thing to think about is that PHP doesn’t have the concept of
modules, and the use statements aren’t importing anything. They are
essentially declaring aliases.
In working with other programmers new to PHP, this has been a major point
of confusion, since use doesn’t behave like importing in JavaScript or
Python, for example. I think this new syntax will lead to further
confusion because it makes namespaces seem even more like modules.
Cheers,
Ben