Hi --

On Tue, 6 Feb 2007, David Flanagan wrote:

> Daniel Berger wrote:
>> 
>> How would String#ord_at be a savings over String#[].ord?
>
> One method lookup and invocation versus two lookups and two invocations 
> plus the creation and garbage collection of a transient String object.
>
>> I'm afraid I don't see such a method as being general enough to warrant 
>> inclusion as part of the core class.
>
> This is a backward compatibility issue.  It seems to me that there will be 
> a general need for a simple way to achieve the the 1.8 behavior.
> I think that warrants the addition of a method.

It's not going to be backward compatible in any case, since [] will
have changed.  I think the reasoning is that people use [].chr more
than they're likely to use [].ord, so offloading the less simple
behavior onto the ord case will save method calls in the long run.


David

-- 
Q. What is THE Ruby book for Rails developers?
A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black)
    (See what readers are saying!  http://www.rubypal.com/r4rrevs.pdf)
Q. Where can I get Ruby/Rails on-site training, consulting, coaching?
A. Ruby Power and Light, LLC (http://www.rubypal.com)