From: Aleks Kissinger Date: 2006-07-30T17:35:59+09:00 Subject: Re: to_i vs. to_int We actually gabbed on this topic a bit recently. See the second half of the "Symbols are your friends" thread from a couple of days ago. On 7/29/06, gabriele renzi wrote: > 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 :) > >