Mark Wilden wrote:
> 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

LOL. Total bs really. it's the guys who learn all the "nooks and 
crannies" that take a language to the next level. Or would you prefer 
Ruby stays "that language that Rails uses".?

I'd prefer to see Ruby on par with the likes  of Perl or Python. I'd 
prefer to see ruby used to write installation scripts, manage system 
processes, and build maps in games like Civ 4 (Python). Not just "that 
rails language".

I applaud the OP for pointing this oddity out. And I hope he continues 
experimenting and posting.
-- 
Posted via http://www.ruby-forum.com/.