Back in My Fundamental Issue with Ruby, I complained about Ruby’s types without the ability to work with/understand types.
Just had another example of the issue. I’ve got this code:
path = ['foo', 'bar', 'baz'] msg.step = path.shift if msg.step == 'foo' # Do something smart end
The problem was that the “do something smart” line was working just fine, and then strangely wasn’t ever being hit later on. WTF?
Turns out the issue is that “msg” is an ActiveRecord instance, and “step” changed from a string type to an integer type in the database, so when I assigned a string to “step”, it silently stored it as 0.
Seriously, either be typed or don’t be typed. It hurts to sit on the fence like this.
(In more positive news, I note that Rails is really a slick system these days, with the exception of its ORM. I’m taking notes for a Grails vs. Rails blog post coming up, which I hope to be more constructive than my previous forays into the area.)
Related posts:
Pingback: Ruby is the Future