From: Michael Fellinger Date: 2010-11-24T21:25:46+09:00 Subject: Re: Ruby 1.8 vs 1.9 On Wed, Nov 24, 2010 at 8:14 PM, Brian Candler wrote: > Chuck Remes wrote in post #963430: >> I use 1.9.2p0 daily and find it to be extremely stable and fast. I would >> say the biggest reason to use it is to get a performance boost. Most of >> your code from 1.8 will "just work."  My code sees a 2-5x speedup on >> 1.9.2 versus 1.8.7. > > And just to give some balance: the biggest reason not to use 1.9 is > because of the incredible complexity which has been added to the String > class, and the ability it gives you to make programs which crash under > unexpected circumstances. > > For example, an expression like > >   s1 = s2 + s3 > > where s2 and s3 are both Strings will always work and do the obvious > thing in 1.8, but in 1.9 it may raise an exception. Whether it does > depends not only on the encodings of s2 and s3 at that point, but also > their contents (properties "empty?" and "ascii_only?") > > The encodings of strings you read may also be affected by the locale set > from the environment, unless you explicitly code against that. This > means the same program with the same data may work on your machine, but > crash on someone else's. And that's why I use and love 1.9. The obvious thing isn't so obvious if you actually care about encodings, and if you are mindful about what comes from where, it's actually helpful to find otherwise hidden issues. I hear nobody complain that 1 / 0 raises but 1.0 / 0.0 gives Infinity, which I find pretty counter-intuitive, and makes me check for .nan? and .infinite? (which also fails if I call it on Fixnum instead of Float). > https://github.com/candlerb/string19/blob/master/string19.rb > https://github.com/candlerb/string19/blob/master/soapbox.rb Many valid complaints there, but nothing that would make me long for the everything-is-a-string-of-bytes approach of 1.8, which made working with encodings very brittle. I can see how this is just annoying to someone who has only dealt with BINARY/ASCII/UTF-8 all their lives, but please consider that most of the world actually still uses other encodings as well. I also want to thank you for writing string19.rb, which is a very helpful resource for me and others, along with the series from JEG II. -- Michael Fellinger CTO, The Rubyists, LLC