From: Mohit Sindhwani Date: 2007-08-31T13:13:37+09:00 Subject: Re: Ruby stupidities Kenneth McDonald wrote: > The title is intentionally (but semiseriously) contentious, but I'm > not trying to say that Ruby is a bad language--I'm using it, right :-) > ? However, any language has its unfortunate share of bad APIs, design > decisions, etc., and Ruby is no exception. I've stumbled across a few, > and thought it might be useful to start up a thread discussing what > people view as Ruby's stupidities. Why? Because it's a lot less > painful to find out about them by reading them than be tracking > obscure errors in one's code. > > In order to keep this on a not-completely-shouting-match level, I > think it's fair to give a reason something you mention as a Ruby > Stupidity is in fact stupid. For example, it violates common sense, it > causes more trouble than it's worth, etc. etc., and to discuss what a > better way of implementing such a feature might be. > > Having said that, here's my first entry. I think it's utterly stupid > (can you tell I just wasted some time tracking this down?) that > > "abc"[0] == "a" > > is false. Why doesn't that work? Because, with a single index, the > array access operator on a string returns, not the character at the > given position, but the _character code_ of the character at that > position. I admit that I've faced this one before :) Cheers, Mohit. 8/31/2007 | 12:13 PM.