|
|
|
|
|
by kmkemp
5100 days ago
|
|
I'm mostly ignorant of Ruby, so maybe you can help me out. 1. And how exactly do they get away with that? What if you wanted to use a class that had a name conflict with a Ruby library class? Import/require are useful for namespace resolution. It seems that not having them would just be limiting your ability to name things cleanly. 2. Well sure, exception handling shouldn't be the rule, but how often you use them isn't usually a language concern (except maybe with Java and checked exceptions). Nonetheless, when you do use them, having your IDE give you shortcuts to write the boilerplate code is a plus. |
|
I just try to avoid going around calling my classes things like "Fixnum" or "Array".
Seriously though, this kind of thing is all set up at the framework level, though you do sometimes have explicit requires for external libraries (gems) that you bring in. The Ruby standard library isn't that big, and Rails' libraries are named and namespaced intelligently and pretty much sit in the background without having to be explicitly invoked too much.
It helps that the main source of Ruby libraries is RubyGems, most RubyGems have a class or namespace named after the name of the gem, and there's a canonical source of RubyGems that doesn't allow you to use the name of gems that already exist.
> Well sure, exception handling shouldn't be the rule, but how often you use them isn't usually a language concern (except maybe with Java and checked exceptions). Nonetheless, when you do use them, having your IDE give you shortcuts to write the boilerplate code is a plus.
I guess Ruby exception handling just doesn't have much boilerplate code.