Ruby 1.9: object heirarchy changed

With this article I’m starting a series of short posts on the differences and improvementa introduced with version 1.9 of Ruby.
In order to better organize internal classes and responsibilities, a new topmost class was introduced:
Class.ancestors
# 1.8 => [Class, Module, Object, Kernel]
# 1.9 => [Class, Module, Object, Kernel, BasicObject]
BasicObject.instance_methods
# => [:==, :equal?, :!, :!=, :instance_eval, :instance_exec, :__send__]
This BasicObject class offers very little methods as you can see, even the object_id is not available for its instances:
o = BasicObject.new
puts o.object_id
# => `<main>': undefined method `object_id' for #<BasicObject:0x672d05c> (NoMethodError)
Italiano
Sei interessato a conoscere tutte le principali novità di Ruby 1.9?
Vedi lo screeencast "pillola" su ThinkCode.TV
Picture credits to Selvin



