Ranges and Enumerable problems

No need to apologize. Tangents can be fun.

I don't dislike the answer - I was just curious about the change. But
now I'm wondering about David's earlier statement that under 1.9,
('!'..'~').to_a works 'correctly'. Does this mean that Range.each has
even more special cases for Strings? That would be unfortunate. It
seems cleaner if Range could use an alternate method (#advance ?)
which would be an alias for #succ in class Object, but would be
overridden by String and other classes where x.succ doesn't always
compare greater than x.

-Adam

···

On 7/3/08, Robert Dober <robert.dober@gmail.com> wrote:

Adam my apologies, instead of logic nitpicking, which was fun of
course, I could have provided an answer to the original question too
;).
But you will not like it :frowning:

I don't dislike the answer - I was just curious about the change. But
now I'm wondering about David's earlier statement that under 1.9,
('!'..'~').to_a works 'correctly'.

No surprise here either
456/26 > ruby1.9 -ve 'p ("!".."~").to_a'
ruby 1.9.0 (2007-12-25 revision 14709) [i486-linux]
-e:1: warning: (...) interpreted as grouped expression
["!", "\"", "#", "$", "%", "&", "'", "(", ")", "*", "+", ",", "-",
".", "/", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]

but my 1.9 version is quite old as you can see, I doubt however that
this has changed.

R.

Hi --

I don't dislike the answer - I was just curious about the change. But
now I'm wondering about David's earlier statement that under 1.9,
('!'..'~').to_a works 'correctly'.

No surprise here either
456/26 > ruby1.9 -ve 'p ("!".."~").to_a'
ruby 1.9.0 (2007-12-25 revision 14709) [i486-linux]
-e:1: warning: (...) interpreted as grouped expression
["!", "\"", "#", "$", "%", "&", "'", "(", ")", "*", "+", ",", "-",
".", "/", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]

but my 1.9 version is quite old as you can see, I doubt however that
this has changed.

Well, I didn't falsify my results :slight_smile: It really did do this:

("!".."~").to_a

=> ["!", "\"", "#", "$", "%", "&", "'", "(", ")", "*", "+", ",", "-",
".", "/", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ":", ";",
"<", "=", ">", "?", "@", "A", "B", "C", "D", "E", "F", "G", "H", "I",
"J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W",
"X", "Y", "Z", "[", "\\", "]", "^", "_", "`", "a", "b", "c", "d", "e",
"f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s",
"t", "u", "v", "w", "x", "y", "z", "{", "|", "}", "~"]

as I stated. I think that means it *has* changed. This is "ruby 1.9.0
(2008-04-30 revision 16244) [i686-darwin9.2.2]"

David

···

On Fri, 4 Jul 2008, Robert Dober wrote:

--
Rails training from David A. Black and Ruby Power and Light:
   Intro to Ruby on Rails July 21-24 Edison, NJ
   Advancing With Rails August 18-21 Edison, NJ
See http://www.rubypal.com for details and updates!

Sorry David I did not remember your post, but I guess it is a good
thing to demonstrate that Ruby1.9 is evolving and we all should
upgrade often :slight_smile:
Cheers
Robert