From: GOTO Kentaro Date: 2002-10-02T10:34:14+09:00 Subject: Re: thoughts on typelessness At Wed, 2 Oct 2002 09:41:17 +0900, Christoph wrote: > > "GOTO Kentaro" wrote > .... > > > > I think "%s" % obj is a kind of implicit conversion. > > > > % ruby -e 'now = Time.now; def now.to_s() "now" end; puts "%s" % now' > > now > > % > > The "print String" conversion seems to follow non obvious > rules - for example no recursion seems to possible ... Interesting. But I did not think so deep. Maybe I picked up a special case. Any way, "to"_ + `an abbreviated class name' looks to mean a special purpose use because to_str and to_ary are so. Then I'd like to see any convention like this: for name %w(Array Float Integer String) module Kernel define_method(name){|a| a.send("to_#{name}")} # or to_#{name.downcase} private name end end -- Gotoken