From: Robert Dober Date: 2006-08-29T04:59:40+09:00 Subject: Re: Integer(nil) versus Float(nil) versus String(nil) ------=_Part_180945_27024566.1156795175670 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 8/28/06, Christoffer Sawicki wrote: > > On 8/24/06, David Vallner wrote: > > Probably. > > > > > > But my Java-addled brain makes me make damn sure nulls / nils don't com= e > > anywhere near I expect actual data, like into collections or numbers. I= f > > you don't rely on automagical conversion to work, it can't bite you if > > it doesn't. Just code explicitly. > > > > That's definitely a valid point, but slightly irrelevant. Well it is your thread but I understand and agree with David that the nil (do not call it null on that list though ;) in a conversion is troubeling. I read him that way that by banning it a part of your inconsistency will go away, do you agree? > The to_foo and #Foo() type conversion methods being different always > > confuses the heck of me, which is why I get paranoid around them. Does > > anyone have a link to some rationale for and explanation of the > difference? > > Integer/Float are usually considered to be the *strict* equivalents of > to_i/to_f. Are they? So far I have never heared that claim. http://www.ruby-doc.org/core/classes/Kernel.html#M002003 says the contrary. I do not necessarily think that is good, but that is how it is documented. Try to feed them non-number strings and you'll see. No you will not, "x".to_i Integer("x") I don't > know anything more about them though. :) > > Anyway, I was a bit puzzled over these two things on Integer/Float: > > 1) Them accepting nil at all > 2) The (IMHO) inconsistency > > I can accept both things as they are, since nothing says they should > act the way I except them to, but I thought it could be good to bring > it up. I too hope that behavior will go away. Cheers, > > -- > Christoffer Sawicki > http://vemod.net/ > > Robert --=20 Deux choses sont infinies : l'univers et la b=EAtise humaine ; en ce qui concerne l'univers, je n'en ai pas acquis la certitude absolue. - Albert Einstein ------=_Part_180945_27024566.1156795175670--