Chad said:
That almost makes me embarrassed to be a Perl hacker on ruby-talk.
We're not all like that. In fact, that's a distinct rarity. So sad
that it's in someone well known that you get to see this nonsense.
Well this is what you get if you force an already angry person to learn
a butt ugly language because some managor never heard of anything other
than ASP.Net, Java and Ruby on Rails. And decided (under these
conditions correctly) that the best option is RoR.
And no matter what you say treating newline as a statement terminator IS
plain stupid. Especially since the Ruby parser is not bright enough to
handle
foo.bar( 1 + 2
+ 3
)
Well, at least it breaks noisily in this case.
And while this is just a syntactic issue that I will most likely end up
learning to accept, the absence of use strict and even the total
unability to specify that I DO want a new variable is something I will
hate till the Ruby community gets through the flaming discussion that
the Perl one had some eight years ago.
Let's see ... what does this code do?
for my $obj (@list) {
$obj->foo()
}
Well, that's clear, it calls the foo() method on all objects in the
@list. OTOH, what does this one do?
list.each { |obj| obj.foo() }
Well, maybe it does the exact some thing ... and maybe it also changes
the obj variable from whatever it was before this line to the last
object in the list. How do you make it clear? Well, you don't. There's
no way to make sure variables do not leak out of blocks. Yeah, most
methods are 5 lines long so it doesn't matter, sure :-}
Jenda
P.S.: To make it "on topic". I don't care whether it's "elseif" or
"elsif". Whatever it is, the docs should state that clearly to alert the
people comming from any of the many languages that chose the other form.