If Ruby Had Imports…
How to Acquire an Instinctual Hatred of Explicit Import Statements
Step 1: write Rails apps full-time for several years.
Step 2: go peek at the top of a file written for virtually any large NodeJS framework.
Step 3: 🤢
All right, that was pretty snarky. I don’t mean to pick on poor JavaScript…it's just that I'm so spoiled with working in a Ruby context where autoloaded classes and modules is just a fact of life.
But what if Ruby did have imports? 🤔
Funny thought experiment aside 😄, if you're wondering how autoloading in Ruby does work and in particular Rails codebases via Zeitwerk, I wrote all about that here. It's a quick overview of a fairly convoluted topic, so feel free to ping me if you have any questions.
’Till next time…
Jared
Don't miss what's next. Subscribe to Fullstack Ruby: