I've glanced at Ruby before, probably after someone remarked on how
clean it is. I just took another look this afternoon, and was once
again found myself ready to abandon the attempt without doing anything
useful, for the usual reasons:
- Lack of documentation: If I write a method that takes a block,
how do I then pass that block on to another method? The introductory
guides give examples, but no general rules for how blocks work. After
a bit of searching, I found the Pragmatic Programmers' guide which,
although good, appears to be at least a year out of date. And I still
haven't found the answer, though I'm not done searching. Then again,
maybe I'm just slow or something.
- Hackishness: The syntax is usually clean, friendly, DWIM, and
the like. But when you look at some of the corner cases, it gets
frightening. Take a look at this from the doc:
When Ruby sees a name such as ``a'' in an expression, it needs to
determine if it is a local variable reference or a call to a method
with no parameters. To decide which is the case, Ruby uses a
heuristic. As Ruby reads a source file, it keeps track of symbols
that have been assigned to. It assumes that these symbols are
variables. When it subsequently comes across a symbol that might be
either a variable or a method call, it checks to see if it has seen a
prior assignment to that symbol. If so, it treats the symbol as a
variable; otherwise it treats it as a method call.
So if I add a local variable "foo", it can silently mask subsequent
calls to a function "foo" that I've been happily calling for a month?
Yikes. Sure, Perl has some wierd things going on in places, but they
mostly just show up in golf games.
Don't get me wrong -- it's a fun, interesting language; if you squint
a bit, it's clean at a higher level. But it still seems like a hack,
not a solid foundation for software. I wouldn't trust it with my file