Re: [PHP-DEV] [RFC] Namespace-scoped declares, again

This is only part of a thread. view whole thread
  106576
August 13, 2019 22:28 markyr@gmail.com (Mark Randall)
On 13/08/2019 21:26, Rowan Collins wrote:
> Ah, that makes sense. Does that necessarily mean we need a dummy class, > though? The autoloading logic in the engine knows that it called the > autoload callback expecting a package definition, so can count as > success that the package is now defined. > > In other words, the file the autoloader included would look like this > (again, sticking to the notion that "package" is separate from > "namespace"):
Personally with file-level opt ins I'm not 100% sold on the benefits of packages over namespace level information. I guess I'm not certain on what problem they're trying to solve that's different from just another object at namespace level. As for the dummy class, the only real benefit is that existing autoloading procedures can be used to locate it and be included with minimal overhead. PHP can call the autoloader internally but it would require userland loaders to be upgraded with it, not exactly a huge stretch, especially with most things being composer-based, but a dummy class would make it work out the box, including optimization steps like dumping the class list. Mark Randall