Hi,

Yukihiro Matsumoto writes:
> Hi,
> 
> Are you having happy Christmas holidays?
> I need to work without holidays, sigh.

oh yeah! I have, thanks for asking ;-) But some of my colleagues are
not so happy: Y2K maintenance... :-/

[...]

> 
> I just remembered we already have two conversion methods!
> 
>   string.to_i
>   Integer(string)
> 
> The latter is more intelligent, it understands `0x', etc prefix to
> decide base radix.  So it may be good to add exception raising feature
> to the latter.  e.g.

As I have understood it,

   Integer("foo12")

should also raise an exception, shouldn't it? I would go a step
further. I would say that there is a difference between conversion and
conversion (sounds silly, neh?) :-/

If I use Integer, Float, String, ... I would raise an exception, if
the result of the conversion couldn't converted back to the original
object. That means:

   s = "12"; i = Integer(s)    # ok, as: String(i) == s
   s = "foo"; i = Integer(s)   # ERROR, as: String(i) != s
   s = "foo12"; i = Integer(s) # ERROR, as: String(i) != s

but also for ...

   i = 12; f = Float(i)        # ok, as: Integer(f) == i 
   f = 12.0; i = Integer(f)    # ok, as: Float(i) == f
   f = 12.2; i = Integer(f)    # ERROR, as: Float(i) != f

There should be explicite methods for rounding like: ceil, floor,
round, ...

IMHO the '.to_x' methods could remain as they are!

[...]

> 
> The another option is to raise exception for non-numeric string at
> every string->integer convsersion.  There's no strong reason to return
> zero for non-numeric strings in Ruby.  e.g.

That, I think, is not necessary. Sometimes it is right pretty to have
to_x methods behaving as they do currently!

[...]

> 							matz.
> 

\cle

-- 
Clemens Hintze  mailto: c.hintze / gmx.net