Hi -- On Sat, 17 Jan 2009, RK Sentinel wrote: > David A. Black wrote: >> Hi -- >> >> I've posted an update to my recent "10 things to be aware of" post >> about the Ruby 1.8 to 1.9 transition: >> > > Thanks. I just caught this in your article: > >> Also, kind of along the same lines, the ?-notation now gives a character rather >than a code. In 1.8: > >> >> ?a >> => 97 >> and in 1.9: > >> >> ?a >> => "a" > > > Recently, I had asked someeone on this forum to confirm that "?" still > works like before, since I use it a lot to check keystrokes in my app, > and I hope to keep the rework to a minimum when porting to 1.9. He > checked out and confirmed it _does_ return a Fixnum in 1.9. > > (i.e, ?\C-a or ?\M-a etc.) > > So apparently that was wrong information. I believe so: $ irb19 irb(main):001:0> ?a => "a" irb(main):002:0> RUBY_DESCRIPTION => "ruby 1.9.1 (2008-12-30 patchlevel-0 revision 21203) [i386-darwin9.5.0]" > One piece of feedback: > > David, when you say "In 1.8, X == 1 and now in 1.9, X == 2 " it would > help us if you would say what we should now do to get the earlier > result. Do you mean the block examples? The semantics are so different that it's hard to discuss it in terms of emulating 1.8 behavior. For example: x = 1 [2,3].each {|x| } # 1.8: x is 3, 1.9: x is 1 In order to get the outer x to be 3, you'd do: x = 1 [2,3].each {|y| x = y } which is such a different technique that I'd be wary of describing it as the equivalent of the 1.8 semantics. David -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.rubypal.com Coming in 2009: The Well-Grounded Rubyist (http://manning.com/black2) http://www.wishsight.com => Independent, social wishlist management!