|
|
|
|
|
by spoiler
4772 days ago
|
|
I love Ruby's syntax. I tries Python, but I didn't like it as much as Ruby, what putt me off about python is the meaningful indentation (although I do not mind that in CoffeeScript). Also, Ruby itself is not slow, but CRuby (MRI, YARV, whatever you call it) is slow; Rubinius ("rbx") is a wonderful (and my personal favourite) alternative for MRI. In fact, I use rbx and EventMachine for a fun app that has a growing number of users! However, when I found some things were too slow in Ruby I just wrote a C extension (yes, yes, I know it's a bit of a controversy). As to why I learnt it: it looked fun, and I was right, Ruby brings me pleasure! |
|
> meaningful indentation
Indentation in other languages has meaning too. If you have Java code, for example, that looks like this:
Can you spot the bug? The topic we're discussing is a huge hint as to what the bug is, but if the only clue you have is bad behavior in a longer program it can be much harder to spot. When skimming the code, the visual cue of the indentation is so strong that it's very easy for your brain to see what the programmer clearly intended to write rather than what's actually there. (The diagnosis of the above bug might be even hairier if the bug was introduced by inserting a "safe" print statement to help you debug an unrelated problem!)Forcing your code's visual cues and behavior to match defeats an entire class of bugs. And even if you start out hating it, ultimately it's like the required semicolons in C/C++/Java: It's an annoyance at first, but after a while it becomes so automatic that you no longer stop to think about it.