Hi --

On Fri, 14 Jan 2005, Robert Klemme wrote:

> About usage of to_int et al: as these methods are fairly recent (compared
> to to_i and others) I'd guess that usage is increasing and they might not
> yet be as prolific as I assumed.  Don't have exact numbers though.

I thought that their main purpose was to be defined on objects that
were expected to have to serve as strings or ints, etc. -- this kind
of thing:

   obj = Object.new
   def obj.to_str; "def"; end

   def another_example(str)
     "abc" << str
   end

   p another_example(obj)  # "abcdef"

as opposed to being called explicitly, for which to_s and to_i would
serve more often.  (Not that to_??? can't be called explicitly, of
course.)


David

-- 
David A. Black
dblack / wobblini.net