On Fri, Jul 3, 2026 at 12:35 PM Larry Garfield <[email protected]>
wrote:

> On Fri, Jul 3, 2026, at 7:32 AM, Michael Morris wrote:
>
> > And this applies for use statements as well.  For example, if `use
> > A\foo;` is foo a class? a function, a constant? Who knows, but this is
> > the moment to find out and execute this handler.
>
> It's known because the syntax says what it is.
>
> use Foo\Bar; // Bar is a class, or a namespace prefix.
> use function Foo\Bar\baz; // baz is a function.
> use const Foo\Bar\Beep; // Beep is a constant.
>

I had forgotten about that. It may simplify things then. Hmm...


>
> This feels somewhat similar to Python, where a given module can have an
> __init__.py file that is automatically loaded the first time the module is
> referenced.  I'm not sure how well that maps into PHP (see previous
> module/package/namespace threads), but it's an interesting model to explore
> for function autoloading.
>
> --Larry Garfield
>

I was aware of the Python approach, but I'm also aware of how beloved magic
file names are in PHP (as in, not - see the argument over treating an
extension differently, let alone a reserved file name).

Anyway, the main reason I brought this up is I cannot recall this exact
approach being discussed before. I don't have the expertise to determine if
the path is viable.

Reply via email to