<p>I'm not clear on the differences between the "current" version of Ruby (1.8) and the "new" version (1.9). Is there an "easy" or a "simple" explanation of the differences and why it is so different?</p>

[{'answer_id': 21621, 'author': 'Tim Sullivan', 'author_id': 722, 'author_profile': 'https://Stackoverflow.com/users/722', 'pm_score': 8, 'selected': True, 'text': '<p>Sam Ruby has a <a href="http://slideshow.rubyforge.org/ruby19.html" rel="noreferrer">cool slideshow that outline the differences</a>.</p>\n\n<p>In the interest of bringing this information inline for easier reference, and in case the link goes dead in the abstract future, here\'s an overview of Sam\'s slides. The slideshow is less overwhelming to review, but having it all laid out in a list like this is also helpful.</p>\n\n<h1>Ruby 1.9 - Major Features</h1>\n\n<ul>\n<li>Performance</li>\n<li>Threads/Fibers</li>\n<li>Encoding/Unicode</li>\n<li>gems is (mostly) built-in now</li>\n<li>if statements do not introduce scope in Ruby.</li>\n</ul>\n\n<h1>What\'s changed?</h1>\n\n<h2>Single character strings.</h2>\n\n<p>Ruby 1.9</p>\n\n<pre><code>irb(main):001:0&gt; ?c\n=&gt; "c"\n</code></pre>\n\n<p>Ruby 1.8.6</p>\n\n<pre><code>irb(main):001:0&gt; ?c\n=&gt; 99\n</code></pre>\n\n<hr>\n\n<h2>String index.</h2>\n\n<p>Ruby 1.9</p>\n\n<pre><code>irb(main):001:0&gt; "cat"[1]\n=&gt; "a"\n</code></pre>\n\n<p>Ruby 1.8.6</p>\n\n<pre><code>irb(main):001:0&gt; "cat"[1]\n=&gt; 97\n</code></pre>\n\n<hr>\n\n<h2>{"a","b"} No Longer Supported</h2>\n\n<p>Ruby 1.9</p>\n\n<pre><code>irb(main):002:0&gt; {1,2}\nSyntaxError: (irb):2: syntax error, unexpected \',\', expecting tASSOC\n</code></pre>\n\n<p>Ruby 1.8.6</p>\n\n<pre><code>irb(main):001:0&gt; {1,2}\n=&gt; {1=&gt;2}\n</code></pre>\n\n<p><strong>Action:</strong> Convert to {1 => 2}</p>\n\n<hr>\n\n<h2><code>Array.to_s</code> Now Contains Punctuation</h2>\n\n<p>Ruby 1.9</p>\n\n<pre><code>irb(main):001:0&gt; [1,2,3].to_s\n=&gt; "[1, 2, 3]"\n</code></pre>\n\n<p>Ruby 1.8.6</p>\n\n<pre><code>irb(main):001:0&gt; [1,2,3].to_s\n=&gt; "123"\n</code></pre>\n\n<p><strong>Action:</strong> Use .join instead</p>\n\n<hr>\n\n<h2>Colon No Longer Valid In When Statements</h2>\n\n<p>Ruby 1.9</p>\n\n<pre><code>irb(main):001:0&gt; case \'a\'; when /\\w/: puts \'word\'; end\nSyntaxError: (irb):1: syntax error, unexpected \':\',\nexpecting keyword_then or \',\' or \';\' or \'\\n\'\n</code></pre>\n\n<p>Ruby 1.8.6</p>\n\n<pre><code>irb(main):001:0&gt; case \'a\'; when /\\w/: puts \'word\'; end\nword\n</code></pre>\n\n<p><strong>Action:</strong> Use semicolon, then, or newline</p>\n\n<hr>\n\n<h2>Block Variables Now Shadow Local Variables</h2>\n\n<p>Ruby 1.9</p>\n\n<pre><code>irb(main):001:0&gt; i=0; [1,2,3].each {|i|}; i\n=&gt; 0\nirb(main):002:0&gt; i=0; for i in [1,2,3]; end; i\n=&gt; 3\n</code></pre>\n\n<p>Ruby 1.8.6</p>\n\n<pre><code>irb(main):001:0&gt; i=0; [1,2,3].each {|i|}; i\n=&gt; 3\n</code></pre>\n\n<hr>\n\n<h2><code>Hash.index</code> Deprecated</h2>\n\n<p>Ruby 1.9</p>\n\n<pre><code>irb(main):001:0&gt; {1=&gt;2}.index(2)\n(irb):18: warning: Hash#index is deprecated; use Hash#key\n=&gt; 1\nirb(main):002:0&gt; {1=&gt;2}.key(2)\n=&gt; 1\n</code></pre>\n\n<p>Ruby 1.8.6</p>\n\n<pre><code>irb(main):001:0&gt; {1=&gt;2}.index(2)\n=&gt; 1\n</code></pre>\n\n<p><strong>Action:</strong> Use Hash.key</p>\n\n<hr>\n\n<h2><code>Fixnum.to_sym</code> Now Gone</h2>\n\n<p>Ruby 1.9</p>\n\n<pre><code>irb(main):001:0&gt; 5.to_sym\nNoMethodError: undefined method \'to_sym\' for 5:Fixnum\n</code></pre>\n\n<p>Ruby 1.8.6</p>\n\n<pre><code>irb(main):001:0&gt; 5.to_sym\n=&gt; nil\n</code></pre>\n\n<p>(Cont\'d) Ruby 1.9</p>\n\n<pre><code># Find an argument value by name or index.\ndef [](index)\n  lookup(index.to_sym)\nend\n</code></pre>\n\n<p>svn.ruby-lang.org/repos/ruby/trunk/lib/rake.rb</p>\n\n<hr>\n\n<h2>Hash Keys Now Unordered</h2>\n\n<p>Ruby 1.9</p>\n\n<pre><code>irb(main):001:0&gt; {:a=&gt;"a", :c=&gt;"c", :b=&gt;"b"}\n=&gt; {:a=&gt;"a", :c=&gt;"c", :b=&gt;"b"}\n</code></pre>\n\n<p>Ruby 1.8.6</p>\n\n<pre><code>irb(main):001:0&gt; {:a=&gt;"a", :c=&gt;"c", :b=&gt;"b"}\n=&gt; {:a=&gt;"a", :b=&gt;"b", :c=&gt;"c"}\n</code></pre>\n\n<p>Order is insertion order</p>\n\n<hr>\n\n<h2>Stricter Unicode Regular Expressions</h2>\n\n<p>Ruby 1.9</p>\n\n<pre><code>irb(main):001:0&gt; /\\x80/u\nSyntaxError: (irb):2: invalid multibyte escape: /\\x80/\n</code></pre>\n\n<p>Ruby 1.8.6</p>\n\n<pre><code>irb(main):001:0&gt; /\\x80/u\n=&gt; /\\x80/u\n</code></pre>\n\n<hr>\n\n<h2><code>tr</code> and <code>Regexp</code> Now Understand Unicode</h2>\n\n<p>Ruby 1.9</p>\n\n<pre><code>unicode(string).tr(CP1252_DIFFERENCES, UNICODE_EQUIVALENT).\n  gsub(INVALID_XML_CHAR, REPLACEMENT_CHAR).\n  gsub(XML_PREDEFINED) {|c| PREDEFINED[c.ord]}\n</code></pre>\n\n<hr>\n\n<h2><code>pack</code> and <code>unpack</code></h2>\n\n<p>Ruby 1.8.6</p>\n\n<pre><code>def xchr(escape=true)\n  n = XChar::CP1252[self] || self\n  case n when *XChar::VALID\n    XChar::PREDEFINED[n] or \n      (n&gt;128 ? n.chr : (escape ? "&amp;##{n};" : [n].pack(\'U*\')))\n  else\n    Builder::XChar::REPLACEMENT_CHAR\n  end\nend\nunpack(\'U*\').map {|n| n.xchr(escape)}.join\n</code></pre>\n\n<hr>\n\n<h2><code>BasicObject</code> More Brutal Than <code>BlankSlate</code></h2>\n\n<p>Ruby 1.9</p>\n\n<pre><code>irb(main):001:0&gt; class C &lt; BasicObject; def f; Math::PI; end; end; C.new.f\nNameError: uninitialized constant C::Math\n</code></pre>\n\n<p>Ruby 1.8.6</p>\n\n<pre><code>irb(main):001:0&gt; require \'blankslate\'\n=&gt; true\nirb(main):002:0&gt; class C &lt; BlankSlate; def f; Math::PI; end; end; C.new.f\n=&gt; 3.14159265358979\n</code></pre>\n\n<p><strong>Action:</strong> Use ::Math::PI</p>\n\n<hr>\n\n<p><s></p>\n\n<h2>Delegation Changes</h2>\n\n<p>Ruby 1.9</p>\n\n<pre><code>irb(main):002:0&gt; class C &lt; SimpleDelegator; end\n=&gt; nil\nirb(main):003:0&gt; C.new(\'\').class\n=&gt; String\n</code></pre>\n\n<p>Ruby 1.8.6</p>\n\n<pre><code>irb(main):002:0&gt; class C &lt; SimpleDelegator; end\n=&gt; nil\nirb(main):003:0&gt; C.new(\'\').class\n=&gt; C\nirb(main):004:0&gt;\n</code></pre>\n\n<p><a href="http://rubyforge.org/tracker/index.php?func=detail&amp;aid=17700&amp;group_id=426&amp;atid=1698" rel="noreferrer">Defect 17700</a>\n</s></p>\n\n<hr>\n\n<h2>Use of $KCODE Produces Warnings</h2>\n\n<p>Ruby 1.9</p>\n\n<pre><code>irb(main):004:1&gt; $KCODE = \'UTF8\'\n(irb):4: warning: variable $KCODE is no longer effective; ignored\n=&gt; "UTF8"\n</code></pre>\n\n<p>Ruby 1.8.6</p>\n\n<pre><code>irb(main):001:0&gt; $KCODE = \'UTF8\'\n=&gt; "UTF8"\n</code></pre>\n\n<hr>\n\n<h2><code>instance_methods</code> Now an Array of Symbols</h2>\n\n<p>Ruby 1.9</p>\n\n<pre><code>irb(main):001:0&gt; {}.methods.sort.last\n=&gt; :zip\n</code></pre>\n\n<p>Ruby 1.8.6</p>\n\n<pre><code>irb(main):001:0&gt; {}.methods.sort.last\n=&gt; "zip"\n</code></pre>\n\n<p><strong>Action:</strong> Replace instance_methods.include? with method_defined?</p>\n\n<hr>\n\n<h2>Source File Encoding</h2>\n\n<h3>Basic</h3>\n\n<pre><code># coding: utf-8\n</code></pre>\n\n<h3>Emacs</h3>\n\n<pre><code># -*- encoding: utf-8 -*-\n</code></pre>\n\n<h3>Shebang</h3>\n\n<pre><code>#!/usr/local/rubybook/bin/ruby\n# encoding: utf-8\n</code></pre>\n\n<hr>\n\n<h2>Real Threading</h2>\n\n<ul>\n<li>Race Conditions</li>\n<li>Implicit Ordering Assumptions</li>\n<li>Test Code</li>\n</ul>\n\n<hr>\n\n<h1>What\'s New?</h1>\n\n<h2>Alternate Syntax for Symbol as Hash Keys</h2>\n\n<p>Ruby 1.9</p>\n\n<pre><code>{a: b}\n\nredirect_to action: show\n</code></pre>\n\n<p>Ruby 1.8.6</p>\n\n<pre><code>{:a =&gt; b}\n\nredirect_to :action =&gt; show\n</code></pre>\n\n<hr>\n\n<h2>Block Local Variables</h2>\n\n<p>Ruby 1.9</p>\n\n<pre><code>[1,2].each {|value; t| t=value*value}\n</code></pre>\n\n<hr>\n\n<h2>Inject Methods</h2>\n\n<p>Ruby 1.9</p>\n\n<pre><code>[1,2].inject(:+)\n</code></pre>\n\n<p>Ruby 1.8.6</p>\n\n<pre><code>[1,2].inject {|a,b| a+b}\n</code></pre>\n\n<hr>\n\n<h2><code>to_enum</code></h2>\n\n<p>Ruby 1.9</p>\n\n<pre><code>short_enum = [1, 2, 3].to_enum\nlong_enum = (\'a\'..\'z\').to_enum\nloop do\n  puts "#{short_enum.next} #{long_enum.next}"\nend\n</code></pre>\n\n<hr>\n\n<h2>No block? Enum!</h2>\n\n<p>Ruby 1.9</p>\n\n<pre><code>e = [1,2,3].each\n</code></pre>\n\n<hr>\n\n<h2>Lambda Shorthand</h2>\n\n<p>Ruby 1.9</p>\n\n<pre><code>p = -&gt; a,b,c {a+b+c}\nputs p.(1,2,3)\nputs p[1,2,3]\n</code></pre>\n\n<p>Ruby 1.8.6</p>\n\n<pre><code>p = lambda {|a,b,c| a+b+c}\nputs p.call(1,2,3)\n</code></pre>\n\n<hr>\n\n<h2>Complex Numbers</h2>\n\n<p>Ruby 1.9</p>\n\n<pre><code>Complex(3,4) == 3 + 4.im\n</code></pre>\n\n<hr>\n\n<h2>Decimal Is Still Not The Default</h2>\n\n<p>Ruby 1.9</p>\n\n<pre><code>irb(main):001:0&gt; 1.2-1.1\n=&gt; 0.0999999999999999\n</code></pre>\n\n<hr>\n\n<h2>Regex “Properties”</h2>\n\n<p>Ruby 1.9</p>\n\n<pre><code>/\\p{Space}/\n</code></pre>\n\n<p>Ruby 1.8.6</p>\n\n<pre><code>/[:space:]/\n</code></pre>\n\n<hr>\n\n<h2>Splat in Middle</h2>\n\n<p>Ruby 1.9</p>\n\n<pre><code>def foo(first, *middle, last)\n\n(-&gt;a, *b, c {p a-c}).(*5.downto(1))\n</code></pre>\n\n<hr>\n\n<h2>Fibers</h2>\n\n<p>Ruby 1.9</p>\n\n<pre><code>f = Fiber.new do\n  a,b = 0,1\n  Fiber.yield a\n  Fiber.yield b\n  loop do\n    a,b = b,a+b\n    Fiber.yield b\n  end\nend\n10.times {puts f.resume}\n</code></pre>\n\n<hr>\n\n<h2>Break Values</h2>\n\n<p>Ruby 1.9</p>\n\n<pre><code>match =\n   while line = gets\n     next if line =~ /^#/\n     break line if line.find(\'ruby\')\n   end\n</code></pre>\n\n<hr>\n\n<h2>“Nested” Methods</h2>\n\n<p>Ruby 1.9</p>\n\n<pre><code>def toggle\n  def toggle\n    "subsequent times"\n  end\n  "first time"\nend\n</code></pre>\n\n<hr>\n\n<p>HTH!</p>\n'}, {'answer_id': 21693, 'author': 'Sören Kuklau', 'author_id': 1600, 'author_profile': 'https://Stackoverflow.com/users/1600', 'pm_score': 4, 'selected': False, 'text': '<p>One huge difference would be the move from Matz\'s interpreter to <a href="http://en.wikipedia.org/wiki/YARV" rel="noreferrer">YARV</a>, a bytecode virtual machine that helps significantly with performance.</p>\n'}, {'answer_id': 1426144, 'author': 'Dave Everitt', 'author_id': 123033, 'author_profile': 'https://Stackoverflow.com/users/123033', 'pm_score': 2, 'selected': False, 'text': '<p>Many now recommend <a href="https://rads.stackoverflow.com/amzn/click/com/0596516177" rel="nofollow noreferrer" rel="nofollow noreferrer">The Ruby Programming Language</a> over the Pickaxe - more to the point, it has all the details of the 1.8/1.9 differences.</p>\n'}, {'answer_id': 22941140, 'author': 'Wim Yedema', 'author_id': 3224442, 'author_profile': 'https://Stackoverflow.com/users/3224442', 'pm_score': 1, 'selected': False, 'text': '<p>Some more changes:</p>\n\n<p><strong>Returning a splat singleton array:</strong></p>\n\n<pre><code>def function\n  return *[1]\nend\n\na=function\n</code></pre>\n\n<ul>\n<li>ruby 1.9 : [1]</li>\n<li>ruby 1.8 : 1</li>\n</ul>\n\n<p><strong>array arguments</strong></p>\n\n<pre><code>def function(array)\n  array.each { |v| p v }\nend\nfunction "1"\n</code></pre>\n\n<ul>\n<li>ruby 1.8: "1"</li>\n<li>ruby 1.9: undefined method `each\' for "1":String</li>\n</ul>\n'}]
['https://Stackoverflow.com/questions/21574', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/757/']