From: Mark Wilden Date: 2008-05-21T13:24:22+09:00 Subject: Re: Is there any good source for the logic behind some of the methods? On May 20, 2008, at 6:20 PM, Michael W. Ryder wrote: > I am trying to figure out why methods that seem to do the same thing > behave so differently. For example Integer("0377") returns 255 as > expected for an octal number but "0377".to_i returns 377. Or why > Integer("12e3") crashes while Float("12e3") returns 12000.0 as > expected. I was hoping to find somewhere that tells when to use one > or the other method depending upon expected inputs. It is very time > consuming to have to keep testing a method to find out it's > limitations. I would have to say that very few of us run into this problem, actually. :) Ruby is an agile language, meaning that it doesn't strive for completeness or perfection. It's just a tool to make some customer happy. And in my (and probably others') experience, parsing strings as octal integers simply doesn't arise in very many use cases. Which is not to say that I don't think you should explore Ruby just as you're doing. But I've found (through 24 years of programming) that asking "why" isn't generally as fruitful as asking "how." I prefer to start from a need, then figure out how the language will let me fulfill that need; rather than starting by learning all the nooks and crannies of a language that, when all is said and done, was designed by imperfect humans. Just some thoughts - not a criticism. ///ark