Legible Blocks
Thus far I have been using this syntax for blocks:
blah.each { |n| print n }
But I've found the following syntax is more legible because the do and end are syntax highlighted:
blah.each do |n| print n end
Maybe the braces can be syntax highlighted but I'm ok with typing big fat words.
What's Not in a Hash
If you address an item that is not in a hash you get a nil value:
?> oHash = {1=>2, 3=>4} => {1=>2, 3=>4} >> ?> oHash[5] => nil
python raises an exception in this case. I prefer the ruby way, I'm not a great fan needing exception handlers all over the place. It can be done in python without an exception handler with a little more typing:
>>> o = {1:2, 3:4} >>> o.get(4, None) >>>
There is one little quirk in the ruby way:
?> oHash[3] = nil => nil >> oHash.keys => [1, 3] >> oHash[3] => nil >> oHash[4] => nil >>
No simple difference between an item of value nil and a non-existant item. However I cannot imagine this ever being a problem.
Aptana Syntax Highlighting Oddity
I was having some weird problems with syntax highlighting in aptana. Some lines were indented more than others and I was having to fiddle about adding and deleting spaces. I finally traced the problem to the way that keywords were highlighted in bold. Because the bold made the font slightly larger it seemed to alter the size of the spaces before the keyword, making them wider. The result was that lines that started in a keyword were indented more than lines without.
The font I was using is called 'Andale Mono', a nice clear readable font except it seems to have this problem, the spacing on bold characters is different to normal characters. I changed the font back to nasty Courier New and the problem went away. However, as I prefer Andale Mono I will simply avoid using bold in the highlighting.

