Sebastian Hungerecker
9/1/2007 2:28:00 PM
Marcin Mielzynski wrote:
> The << direction is correct (and intuitive IMHO), given:
>
> class A < B
> end
>
> This can do two things, either creates and opens class A extending class
> B or reopens class A if it already exits
> [...]
> class << s
> end
>
> What this does ? it either creates and opens singleton class for s
> instance or reopens the singleton it if it already exits. Since
> singleton classes dont have their names you could also imagine
> <anonyous_name> between class and << tokens here.
Yes, but there is a major difference between those two. In the former case A
inherits from B, but in the latter case the singleton class does *not*
inherit from self, self inherits from the singleton class (well actually self
is an instance of the singleton class, but the point is that self is based on
the class and not the other way around), so Ben has a point when he says,
that the arrows should point in the other direction.
--
NP: Iron Maiden - The Clairvoyant
Jabber: sepp2k@jabber.org
ICQ: 205544826