On Tue, Oct 27, 2009 at 4:16 PM, Paolo Bonzini <[email protected]> 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 implementation 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). > lee _______________________________________________ help-smalltalk mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-smalltalk
