3 ms·
Yes, Ruby. But there's tradeoffs and frankly Python's file name = namespace name approach makes finding things much easier when you don't know where they've bee
by hetman 3y ago
Yes, Ruby. But there's tradeoffs and frankly Python's file name = namespace name approach makes finding things much easier when you don't know where they've been imported from.
In Ruby people achieve something similar by convention (explicitly creating a namespace and keeping the names in sync with the file name), but not everyone follows convention and things can turn into a mess.
If I had to suggest one flaw in Ruby it would be this, in many other ways I find it nicer to code in then Python, but honestly this one thing is enough to really sour the experience.
- cortesoft 3y agoThe ability to open and modify any class at any time really prevents filenames from being the namespace. It is both a powerful feature and a hindrance to code discoverability. Discoverability in Ruby is usually done via IRB, and you can call "source_location" on a method to find where in code it the method is defined (or redefined, as can happen in Ruby)