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?
相关问题
- How to specify memcache server to Rack::Session::M
- Why am I getting a “C compiler cannot create execu
- reference to a method?
- ruby 1.9 wrong file encoding on windows
- gem cleanup shows error: Unable to uninstall bundl
相关文章
- Ruby using wrong version of openssl
- Difference between Thread#run and Thread#wakeup?
- how to call a active record named scope with a str
- “No explicit conversion of Symbol into String” for
- Segmentation fault with ruby 2.0.0p247 leading to
- How to detect if an element exists in Watir
- uninitialized constant Mysql2::Client::SECURE_CONN
- ruby - simplify string multiply concatenation
Some more changes:
Returning a splat singleton array:
array arguments
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_s
Now 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.index
DeprecatedRuby 1.9
Ruby 1.8.6
Action: Use Hash.key
Fixnum.to_sym
Now 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
tr
andRegexp
Now Understand UnicodeRuby 1.9
pack
andunpack
Ruby 1.8.6
BasicObject
More Brutal ThanBlankSlate
Ruby 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_methods
Now 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_enum
Ruby 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!
One huge difference would be the move from Matz's interpreter to YARV, a bytecode virtual machine that helps significantly with performance.
Many now recommend The Ruby Programming Language over the Pickaxe - more to the point, it has all the details of the 1.8/1.9 differences.