From: Ara.T.Howard@... Date: 2004-10-01T00:55:01+09:00 Subject: Re: Range syntax theory On Thu, 30 Sep 2004, gabriele renzi wrote: > actually, I thought till one moment ago that ... was going to be deprecated. > I looked up and found that I misremembered this: > http://www.rubyist.net/~matz/slides/rc2003/mgp00025.html > > I'd strongly advocate the elimination of z...y . It is completely non > obvious, and it has no advantage _i can see_ over x..k . programming using the 'offset, length' paradigm lead to much more elegant code than a 'start, end' paradigm and is used everywhere because of it. consider words = %w( one two three four ) # # process elements two at a time # len = 2 r = 0...(a.size / 2) r.each{|off| p words[off, len]} # vs len = 2 r = 0..((a.size / 2) - 1) r.each{|off| p words[off, len]} # # process first/last half of a # n = words.size a = 0 b = n / 2 puts "first #{ b }" (a...b).each{|i| p words[i]} puts "last #{ b }" (b...n).each{|i| p words[i]} # vs puts "first #{ b }" (a..(b - 1)).each{|i| p words[i]} puts "last #{ b }" (b..(n - 1)).each{|i| p words[i]} in short i think we'd since an instant rush of 'off by one' errors if ruby disallowed the '...' operator and obfusicate many elegant algorithims which follow this paradigm. regards. -a -- =============================================================================== | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | A flower falls, even though we love it; | and a weed grows, even though we do not love it. | --Dogen ===============================================================================