I'm getting to the part of software framework design, where I run into the boundary of what is possible without [ static analysis ]. Once you enable static analysis, and [ arbitrary rewrite instructions ], then anything is possible, so I don't want to go there right now, as I am still working in JavaScript for its role as lingua franca.
So, it's pretty easy to design [ dependency inversion, DI ] at the [ module ] level, such that modules are never called directly, but are called by a platform-caller, and given platform-controlled-execution-contexts.
But if we want to be quite asinine, in a zero-trust sort of way, then we would want to implement DI at the fucking [ function ] level, in other words, such that [ EVERY NON-TRIVIAL FUNCTION ] is never called directly, but by a platform-caller, in a platform-controlled-execution context.
Trying to figure out how this maps back to [ developer experience ], we could think about whether ( or not ) a folder tree of script files, could be homomorphic to the [ call tree ] of the entire program.
Now no one [ needs this all the time ], but in terms of framework design, it seems reasonable to provide it as infrastructure, which could be [ read-once on-startup ] and [ tree-shaken / memoised / inlined ] thereafter. The [ framework user ] would then just opt-in to each available feature as preferred.
Woe is me. Why did I decide to be so nerdy about life?