From: David Vallner Date: 2006-08-25T06:30:54+09:00 Subject: Re: Integer(nil) versus Float(nil) versus String(nil) Christoffer Sawicki wrote: > Dear Rubyists, > > def x() yield rescue :error end > > [ x { Integer(nil) }, x { Float(nil) }, x{ String(nil) } ] > # => [0, :error, ""] > > Isn't that a bit inconsistent? > > Cheers, > Probably. But my Java-addled brain makes me make damn sure nulls / nils don't come anywhere near I expect actual data, like into collections or numbers. If you don't rely on automagical conversion to work, it can't bite you if it doesn't. Just code explicitly. 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? David Vallner