4 ms·
I used to have a preference for Ruby but Python has a single killer feature missing for me from Ruby and that is explicitly imported module symbols. When looki
by hetman 9y ago
I used to have a preference for Ruby but Python has a single killer feature missing for me from Ruby and that is explicitly imported module symbols.
When looking at new unfamiliar code in Ruby there's just no way of instantly knowing which symbols come from which files/gems. There are conventions, sometimes these are followed well, sometimes not. Either way it adds a lot to the mental load of parsing new code or even old code you've written your self. Ruby's module import system is just too much like C's #include.
- antod 9y ago> I used to have a preference for Ruby but Python has a single killer feature missing for me from Ruby and that is explicitly imported module symbols. As someone who has to now deal with a couple of complicated/convoluted Ruby codebases, that is one of the biggest things I miss from Python too.
- sanderjd 9y agoYeah, I've come to think this is perhaps Ruby's biggest design miss. It can be really hard to trace dependencies in Ruby, and doing so is a prerequisite for any deep understanding of what's going on. (Granted, this is mostly a problem in Rails projects, but the fact is that Ruby makes this problem possible.)
- Daishiman 9y agoThis is the number 1 failure in Ruby for me. It makes large codebases unmaintainable in the long term.
- jeltz 9y agoYes, Ruby is my favorite language but they really messed up the module system. Ruby basically has no module system at all and everything is in the global namespace.
- hetman 9y agoI mean, that's not technically true, there's definitely a module system. In fact, in some ways Ruby's module system is more powerful than Python's since it's completely divorced from the concept of the file. You can split a single module across multiple files or create multiple modules in a single file. You can nest modules as well of course. The problem is with the module import system, which as you alluded, imports the module structure in a given file into the global namespace. And it imports everything! There's simply no way to say which bits you want and where they should go. I actually don't really see a reason why the import system could not be changed while keeping the module system in general as is. I wonder if anyone has ever tried something like that...