On 8/23/06, Robert Klemme <shortcutter / googlemail.com> wrote:
> 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?
>
> Is this better?
>
> irb(main):003:0> nil.to_i
> => 0
> irb(main):004:0> nil.to_f
> => 0.0
> irb(main):005:0> nil.to_s
> => ""

Well, I'd say that it confirms that the original case is an inconsistency.

-- 
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/