From: Artur Merke Date: 2003-11-17T10:24:58+09:00 Subject: Re: to_i > IMHO this is a struggle between convenience and cleanness. I guess > Matz decided for convenience in this case, maybe because in most cases > using 0 is ok. If you want to do correct input checking you do > /^[+-]?\d+$/ =~ foo anyway. > IMO, it has to do with the principle of least surprise, and it is a BIG surprise to get "hello".to_i -> 0 I think this should be viewed more general (not just for the methods to_i, to_f etc.). If the application of a method makes no sense for an input, then a nil value makes more sense as a return value (and shouldn't surprise anybody), then an arbitrary ambiguous value. Artur