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
system.
/s
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|