From: matz@... (Yukihiro Matsumoto) Date: 2002-06-25T17:35:23+09:00 Subject: Re: No exceptions from String#to_i Hi, In message "Re: No exceptions from String#to_i" on 02/06/25, Paul Brannan writes: |Unfortunately, it's not possible to do this with user-defined data |types. If I have a String-like class with a to_i method that I want to |return 0 on error, then I can do that, but then Integer() will also |return 0 on error. If I want Integer() to raise an exception on error, |then to_i must also raise an exception on error. | |It's not good to have a standard library feature that user libraries |cannot emulate. How about Array(), Integer(), String() use to_ary, to_int, to_str respectively [ruby-talk:43014], and Float() raises error if to_f return NaN? matz.