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?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Sam Ruby has a cool slideshow that outline the differences.
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.
Ruby 1.9 – Major Features
What’s changed?
Single character strings.
Ruby 1.9
Ruby 1.8.6
String index.
Ruby 1.9
Ruby 1.8.6
{‘a’,’b’} No Longer Supported
Ruby 1.9
Ruby 1.8.6
Action: Convert to {1 => 2}
Array.to_sNow Contains PunctuationRuby 1.9
Ruby 1.8.6
Action: Use .join instead
Colon No Longer Valid In When Statements
Ruby 1.9
Ruby 1.8.6
Action: Use semicolon, then, or newline
Block Variables Now Shadow Local Variables
Ruby 1.9
Ruby 1.8.6
Hash.indexDeprecatedRuby 1.9
Ruby 1.8.6
Action: Use Hash.key
Fixnum.to_symNow GoneRuby 1.9
Ruby 1.8.6
(Cont’d) Ruby 1.9
svn.ruby-lang.org/repos/ruby/trunk/lib/rake.rb
Hash Keys Now Unordered
Ruby 1.9
Ruby 1.8.6
Order is insertion order
Stricter Unicode Regular Expressions
Ruby 1.9
Ruby 1.8.6
trandRegexpNow Understand UnicodeRuby 1.9
packandunpackRuby 1.8.6
BasicObjectMore Brutal ThanBlankSlateRuby 1.9
Ruby 1.8.6
Action: Use ::Math::PI
Delegation Changes
Ruby 1.9
Ruby 1.8.6
Defect 17700
Use of $KCODE Produces Warnings
Ruby 1.9
Ruby 1.8.6
instance_methodsNow an Array of SymbolsRuby 1.9
Ruby 1.8.6
Action: Replace instance_methods.include? with method_defined?
Source File Encoding
Basic
Emacs
Shebang
Real Threading
What’s New?
Alternate Syntax for Symbol as Hash Keys
Ruby 1.9
Ruby 1.8.6
Block Local Variables
Ruby 1.9
Inject Methods
Ruby 1.9
Ruby 1.8.6
to_enumRuby 1.9
No block? Enum!
Ruby 1.9
Lambda Shorthand
Ruby 1.9
Ruby 1.8.6
Complex Numbers
Ruby 1.9
Decimal Is Still Not The Default
Ruby 1.9
Regex “Properties”
Ruby 1.9
Ruby 1.8.6
Splat in Middle
Ruby 1.9
Fibers
Ruby 1.9
Break Values
Ruby 1.9
“Nested” Methods
Ruby 1.9
HTH!