Lukas, do you think the second statement in this method could be removed, it would take a lot less time to know if a class is abstract.
RBAbstractClass>>isAbstract (self whichSelectorsReferToSymbol: #subclassResponsibility) isEmpty ifFalse: [^true]. model allReferencesToClass: self do: [:each | ^false]. ^true I know it would change the definition of what is an abstract class for RB, but i'm just wondering if this is ok: "A Class is abstract if it defines a subclassResponsibility method and no other classes reference it" The second clause in my opinion could be avoided. Maybe it would be better to separate this method into: RBAbstractClass>>isAbstract ^ (self whichSelectorsReferToSymbol: #subclassResponsibility) notEmpty RBAbstractClass>>isUnreferenced model allReferencesToClass: self do: [:each | ^false]. ^true Thanks, Fernando _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
> Lukas, do you think the second statement in this method could be removed, it would take a lot less time to know if a class is abstract.
> > RBAbstractClass>>isAbstract > (self whichSelectorsReferToSymbol: #subclassResponsibility) isEmpty > ifFalse: [^true]. > model allReferencesToClass: self do: [:each | ^false]. > ^true > > I know it would change the definition of what is an abstract class for RB, but i'm just wondering if this is ok: > > "A Class is abstract if it defines a subclassResponsibility method and no other classes reference it" > > The second clause in my opinion could be avoided. Just recently I looked at that definition too. It is a bit strange. Also given that it only looks for #subclassResponsibility in the class itself and not in the superclasses. Unfortunately changing anything breaks some tests. As discussed previously there is not a single definition of an abstract class, so maybe it is best if you add your own domain-specific implementation of #isAbstract. Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
Ok, that's what i've did.
Just wanted to check if somebody else also found weird that definition. Thanks Lukas, Fernando On Feb 11, 2010, at 12:14 AM, Lukas Renggli wrote: >> Lukas, do you think the second statement in this method could be removed, it would take a lot less time to know if a class is abstract. >> >> RBAbstractClass>>isAbstract >> (self whichSelectorsReferToSymbol: #subclassResponsibility) isEmpty >> ifFalse: [^true]. >> model allReferencesToClass: self do: [:each | ^false]. >> ^true >> >> I know it would change the definition of what is an abstract class for RB, but i'm just wondering if this is ok: >> >> "A Class is abstract if it defines a subclassResponsibility method and no other classes reference it" >> >> The second clause in my opinion could be avoided. > > Just recently I looked at that definition too. It is a bit strange. > Also given that it only looks for #subclassResponsibility in the class > itself and not in the superclasses. > > Unfortunately changing anything breaks some tests. As discussed > previously there is not a single definition of an abstract class, so > maybe it is best if you add your own domain-specific implementation of > #isAbstract. > > Lukas > > -- > Lukas Renggli > http://www.lukas-renggli.ch > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
Free forum by Nabble | Edit this page |