[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] Re: [patch] Enhance to kernel/

From: Lee Duhem
Subject: [Help-smalltalk] Re: [patch] Enhance to kernel/
Date: Tue, 27 Oct 2009 17:15:13 +0800

On Tue, Oct 27, 2009 at 4:16 PM, Paolo Bonzini <address@hidden> wrote:
> On 10/27/2009 04:40 AM, Lee Duhem wrote:
>> Subclasses of nil? I didn't understand what this means,  can you explain
>> further
>> or point to some documents?
> While 99% of the classes are subclasses of Object, it is also possible to
> create classes that do not inherit from anything (or equivalently, whose
> subclass is nil).  In this case, the metaclass will be a subclass of Class;
> so I used in my example "Class allSubclassesDo:" to get the metaclasses
> (which provide class-side methods), and go to the classes (which provide the
> instance side) by sending #asClass.

The only classes I can found whose superclass is nil are Object, Autoload and
Kernel.AutoloadClass, which all can be accessed through subclass of Class and
#asClass, as you said. So for Symbol>>#implementors, your suggested
is enough.

> By the way, the reason why I didn't like #allSuperclasses is the following.

Do you mean #subclasses?

>  The #superclass and #subclasses methods return the classes that are
> "adjacent" (one level up or one level down) in the hierarchy. Prefixing
> "all" gives also the indirect superclasses/subclasses. #superclasses then
> would be a method that returns an array of direct superclasses (which would
> have a single element, since Smalltalk only has single inheritance).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]