[#955] Ruby 1.4.3 — Yukihiro Matsumoto <matz@...>
Ruby 1.4.3 is out, check out:
1 message
1999/12/07
[#961] Ruby compileable by C++ compiler? — Clemens Hintze <c.hintze@...>
Hi,
8 messages
1999/12/10
[#962] Re: Ruby compileable by C++ compiler?
— matz@... (Yukihiro Matsumoto)
1999/12/10
Hi,
[#963] Re: Ruby compileable by C++ compiler?
— Clemens Hintze <clemens.hintze@...>
1999/12/10
Wei,
[#964] Bastion or SecurityManager for Ruby? — Clemens Hintze <clemens.hintze@...>
Hi,
15 messages
1999/12/10
[#966] Re: Bastion or SecurityManager for Ruby?
— nakajima kengo<ringo@...>
1999/12/10
Hello Clemens,
[#967] Re: Bastion or SecurityManager for Ruby?
— matz@... (Yukihiro Matsumoto)
1999/12/10
Hi,
[#989] a question about to_i — Friedrich Dominicus <Friedrich.Dominicus@...>
Sorry, I'm quite new to ruby. But I encounterd the following problem. If
17 messages
1999/12/19
[ruby-talk:01015] Re: a question about to_i
From:
Clemens Hintze <c.hintze@...>
Date:
1999-12-31 14:01:37 UTC
List:
ruby-talk #1015
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