"Nobuyoshi Nakada" <nobu / ruby-lang.org> wrote in message 
news:20071205020914.E6311E0666 / mail.bc9.jp...
> Hi,
>
> At Wed, 5 Dec 2007 08:40:11 +0900,
> Just Another Victim of the Ambient Morality wrote in [ruby-talk:282100]:
>>     Why is there any "converting" to do?  How can this not work?
>>     My best guess is that the Range class is not written in Ruby and, 
>> hence,
>> has funny limitation on how it may work.
>
> Yes, and performance issue.

    Just so I'm clear on this; the Range class is implemented in C for 
performance reasons?  Was the performance of a Ruby version actually an 
issue?  I don't think anybody here uses Ruby for its blazing speed.  I've 
said this before but I guess it bears repeating.  I don't use Ruby to write 
fast programs, I use Ruby to write programs fast.  This is, obviously, just 
a personal opinion but that's the role Ruby plays for me and I think it's 
the most common case.
    Furthermore, I think there is an important lesson to be had, here. 
There are many different stories, out there, that exemplify this but they 
all end with the same phrase: I can make my program fast, too, if it didn't 
have to work.  This implementation of Range doesn't work.  At the very 
least, it's buggy, which, to some people, is the same thing.
    Even if performance were important, it didn't even fall back onto a Ruby 
implementation.  It might be a little harder to maintain but you could write 
a Ruby version and use that whenever you encounter a "RangerError: bignum 
too big to convert into 'long'" error.  I don't think Range changes too much 
between Ruby releases, so I really don't see it being a maintenance 
headache.  Again, generally, speaking, a slow program that works is better 
than a fast program that doesn't work...
    Finally, the .each method worked!  I didn't let it run all the way to 
MAX_LONG, or whatever the constant is, if there is a constant, but you all 
know what I mean.  Maybe a bug occurs there but what little I let run 
worked.  How can .each work but .step not work?  Especially ironic since 
.step produced less iterations than .each.  I mean, where's the concern for 
performance, there?  You'd imagine that there'd be more concern for 
performance for .each since it will produce more iterations...
    So, perhaps all this can be fixed for Ruby 1.9 and Rite?  What do you 
all think?
    Thank you...