0

I'm reading through Why's (poignant) Guide to Ruby, and in chapter 5, when he's discussing the ability to analyze class structure by using the :superclass method, he has this snippet of irb interaction:

irb> Class.superclass
  => Module
irb> Kernel.class
  => Module
irb> Module.superclass
  => Object
irb> Object.superclass
  => nil

I attempted to recreate this in my irb and got the following output:

irb> Class.superclass
  => Module
irb> Kernel.class
  => Module
irb> Module.superclass
  => Object
irb> Object.superclass
  => BasicObject
irb> BasicObject.superclass
  => nil

I know that many languages now follow this paradigm of having virtually everything inherit from a single, parent object.

My question is, when and why did Ruby introduce a BasicObject class, which extends to Object? Was the Object class not good enough for you?! Sheesh!

Taylor Lopez
  • 813
  • 1
  • 8
  • 28

0 Answers0