It was thus said that the Great Coda Highland once stated:
> On Sat, Apr 20, 2019 at 4:12 PM Sean Conner <email@example.com> wrote:
> > Okay ... how would you like to see this work? Also, how do other
> > langauges like Python or Ruby handle this? How does npm handle this, given
> > that has like a zillion modules?
> npm requires that modules have unique names (first come first serve) and
Okay, pretty much the same as Lua then.
> the import name always matches the directory containing the module. The
Again, pretty much the same as Lua.
Pretty much, but not entirely. The fact that some modules don't do this is one of the reasons this thread has come up at all.
> import scheme also does aggressive namespacing so you have to go out of
> your way to do stuff that might screw up some other module's transitive
Okay, so how does *this* work then?
Mostly, ironclad module scoping. Each file has its own global scope, and you have to explicitly push things out into the actual global-global scope if that's something you REALLY want to do -- and there's basically never a good reason to unless you're building automated testing tools. (And even then it's not a GREAT idea. Those do indeed end up stepping on toes.)
Duplicated dependencies don't necessarily even get mapped onto each other. If they're not the same module (with compatibility determined by the importer's explicitly-requested versioning information) then you can actually end up with two copies of the module loaded in, and since they're different modules with isolated namespaces they don't interfere with each other. It's not the BEST solution to dependency hell because it leads to bloating and bugfixes that don't get applied consistently, but it does mean that a transitive dependency is a little less likely to screw you over.