On 3 June 2025 03:38:58 BST, Larry Garfield <[email protected]> wrote:
>I fundamentally do not believe pulling arbitrary files into such a structure is wise, possible,
>or will achieve anything resembling the desired result, because *basically no application or library
>is single-file anymore*.
I don't think anybody, in any of the examples on this thread, has ever suggested listing
individual files to be loaded into the container/module/whatever.
The suggestions I can think of have been:
- track things recursively, e.g. if A.php is in the container, and loads B.php, put B.php in the
container
- choose based on directory, e.g. whenever the file path being loaded begins
"/var/www/plugins/foo", put it in the container (this seems by far the simplest to me)
- choose based on being in a Phar archive, i.e. whenever the file path being loaded begins
"phar:/var/www/plugins/foo.phar:" (this seems entirely equivalent to the previous point to
me)
Perhaps what you're picturing is that the compiler needs to know up front what classes do and
don't exist, so want to create some kind of index? That's not how I picture it. If code in
the container references a class that doesn't exist, it should call any autoloaders registered
*inside* the container, and if they fail to define the class, it should error as normal.
There needs to be some way to "import" and "export" symbols to communicate
between the container and its host application, but I think for *those* it is safe to list
individual items, because you're not trying to pull their dependencies, just point to the right
piece of code.
Rowan Tommins
[IMSoP]