On Oct 23, 1:06=A0am, John Mair <jrm... / gmail.com> wrote:

> Dude, instance variables are not inherited in this way. Every object
> gets its OWN instance variable table, including the Object class. There
> is no confusion and no mix up, behold:
>
> class X
> =A0 def self.to_a
> =A0 =A0 @a || =3D 10
> =A0 end
> end
>
> class Y
> =A0 def self.to_a
> =A0 =A0 @a ||=3D 20
> =A0 end
> end
>
> X #=3D> 10
> Y #=3D> 20
>
> class Object
> =A0 @a =3D 30
> end
>
> X #=3D> 10
> Y #=3D> 20
>
> @a #=3D> 30
>
> Having the instance variables on the Object class would NOT cause any of
> the conflicts you guys are talking about :)

You're right. I extrapolated from the instance case and made a
mistake.

It's still a bad idea to have main and Object intertwined for the
other reasons I have mentioned, so if anything changes I'd rather see
it change in that regard. But with regards to the current
functionality of Ruby, other than toplevel methods being made private,
I do not see any  significant difference. As your correction to my
error points out, the toplevel instance variables are not currently
the same as Object class' instance variables. But I don't think it
would be a problem if they were. So you may well be right --main could
just as well be the Object class itself and everything would work as
before.

(Interestingly I played around with class variables (@@a) and they in
fact can be changed from the toplevel, effecting any class already.)