matz / netlab.co.jp (Yukihiro Matsumoto) writes:

> No, no.  I'd happy to change the behavior, provided if:
> 
>   (a) gain and loss are clarified.
>   (b) incompatibility damage estimate is done.
> 
> I guess few programs would be affected by this change.  So the point
> should be clarification.

Well, the PLS would suggest that str[n] should return nil when
str[n,1] does, and vice versa.

Returning nil at the end would also eliminate a source of errors

  count = 0
  str = "hello"
  count += 1 while str[count]
  puts "Size = #{count}"        #=> 5

  count = 0
  str = "hello"
  count += 1 while str[count, 1]
  puts "Size = #{count}"        #=> 6


I can't speak to the risks - I don't know how many people have relied
on the existing behavior (although I can't imagine it's very many, as
the behavior doesn't seem intuitive).


Regards


Dave