Sam Sungshik Kong wrote: > 1. In irb, if I type self, it returns main which is type of Object. > >>self > > =>main > >>self.class > > =>Object > >>main > > NameError: undefined local variable or method `main' for main:Object > from (irb):28 > from :0 > > I understand that main is an instance of type Object. > Why can't I access main directly like main.something? > What *actually* is main? > A global instance? That's a good question. You could do $main = self at the top of your code if you wanted to treat the object as a global instance. But most of the time, I just forget that this object exists. IMHO, this object exists primarily so that you can write and call methods in the top-level scope and then easily migrate them inside a class or module. A trivial example: --- def add(x,y) x+y end p add(1,3) --- --- module Operations def add(x,y) x+y end end include Operations p Operations.add(1,3) ---