From: Gavin Sinclair Date: 2002-08-05T07:54:14+09:00 Subject: Re: #Re: String -> Integer anomoly? ----- Original Message ----- From: "Kent Dahl" > Gavin Sinclair wrote: > > > > Hmmm, strikes me as a violation of POLS. > > > > Integer("012") != "012".to_i > > > > What do others think? > > Doesn't violate my PoLS atleast. Since Integer is a method of Kernel, > and to_i (in this case) is a method of String, I am not surprised to see > them have different takes on the matter. As in > "Hey, I'm the kernel, and I care about hex, octal and such geeky > stuff." > and > "Hey, I'm a (l)user input string, you don't think I'd be trying to be > octal or anything that geeky, do ya?" > Interesting, because it surprised me when I found out that Integer was a Kernel method! I was thinking it must be a method of Integer, and playing with irb, trying to create a class that could be instantiated in that way (like Dir["."]). Alas, I couldn't and it was not until I saw Guy's message that I knew about Kernel::Integer(). Now, if Kernel::Integer() is so geeky, why can't it accept a radix? Gavin