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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
Outside of code tags, you may need to use entities for some characters:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||