On 15 July 2026 13:48:07 BST, Michael Morris <[email protected]> wrote:
>The RFC draft I put up that seems to have fell into the lost stack might be
>coupled with this. If I'm going to run that command, whatever it's called,
>the namespace autoload process seems the logical place to do it to insure
>it is called before the namespace is invoked the first time. Otherwise
>you'll have to have this declare at the top of every file in the namespace
>which could be awkward.


Setting declare directives across multiple files is something that's come up 
many times over the years, but it needs a lot more than autoloading. 

Right now, the compiler looks at one file at a time, and OpCache will reuse 
that compiled form whenever that same file is included.

For one file to influence how another file is compiled, you need a way to say 
either "this code file will *only ever* be loaded in the context of this 
setting file", or "the cache for this code file is *only valid* in the context 
of this setting file".

Either way, it's not enough to just say "declare this setting for any matching 
code files from now on", whether you have an autoloader callback or not.

In other words, this strays firmly into the "native package"/"module" design 
space.



Rowan Tommins
[IMSoP]

Reply via email to