4 ms·
It's certainly a lot better than Ruby's require which just executes code and alters global virtual machine state. Not too different from C's #include. My favor
by matheusmoreira 5y ago
It's certainly a lot better than Ruby's require which just executes code and alters global virtual machine state. Not too different from C's #include.
My favorite is Javascript's. Modules are objects containing functions and data, require returns such objects. Simple, elegant. Completely reifies the behind-the-scenes complexity of Python's import, making it easily understandable.
- brundolf 5y agoThough that's not how JS's new module system works, which I would say is also elegant in its own ways, but juggling two different systems is less so
- matheusmoreira 5y agoI have no idea why they added a module system to the Javascript language itself. The old one was so awesome. Not sure what advantages the new system offers.
- osmarks 5y agoLua does the same thing as JS. It's basically "dofile" with some indirection and extra path resolution logic.