From: gabriele renzi Date: 2006-07-30T05:50:12+09:00 Subject: Re: to_i vs. to_int dblack@wobblini.net ha scritto: > Hi -- > >> d> class S >> d> def to_int >> d> 2 >> d> end >> d> end >> >> d> puts 2 + S.new # TypeError: S can't be coerced into Fixnum >> >> puts 2 | S.new also, Arrays seem to like it: >> a=Object.new => # >> def a.to_int() 2 end => nil >> [0,1,3][a] => 3 >> Array.new(a){ 0 } => [0, 0] > > Interesting. What's the rationale for not doing the conversion for + > and - and other operator/methods? I'd like to know the same :)