3 ms·
I think part of the reason this doesn't come up in Ruby is that Ruby doesn't have Python's powerful namespacing system. In Python, it's reasonable to have a pa
by ryanf 15y ago
I think part of the reason this doesn't come up in Ruby is that Ruby doesn't have Python's powerful namespacing system.
In Python, it's reasonable to have a package with just functions in it, whereas in Ruby, writing a top-level method means polluting every object in the system. You can write modules that have singleton methods on them, but you still don't have anything as flexible as Python's "from pkg import foo, bar"—the caller needs to either write "ModuleName.my_function" at every call site, or use "include" and end up with the module's methods as part of the consuming class's interface.
- judofyr 15y agoImplicit self and late binding in Ruby makes it hard to implement a proper namespacing system without breaking other semantics :( After working with Perl (which has a similar namespacing), I must it's something I really miss when I come back to Ruby.