Thank you for your feedback Camille, 2015-02-10 10:24 GMT+01:00 Camille <camille.teruel@gmail.com>:
On 09 Feb 2015, at 18:24, Nicolai Hess <nicolaihess@web.de> wrote:
I thought, Behaviors define the "behavior" of objects, therefore:
Integer is a behavior, because it defines the behavior of "integer objects" Integer class is a behavior because it defines the behavior of the object "Integer".
5 isBehavior -> false. Integer isBehavior -> true. Integer class isBehavior -> true.
What about Traits?
Traits are "behavioral(?)", but they don't define the behavior alone, only the composition of Traits in an actual class defines the behavior of an Object.
TClass isBehavior -> false.
So far so good.
In fact the first time I saw this I was a bit surprised, I was expecting it to return true. After all Trait class inherits TraitBehavior that uses the TBehavior trait. Sure a trait alone doesnât define the whole behavior of an object but at least part of it. In fact itâs because there is many senders of isBehavior which expect it to return true only if the receiver is instanciable. But still itâs a bit confusing.
Smalltalk globals allBehaviors includes:TClass -> true !
No suprise, because #allBehaviors explicitly collect all classes and traits. But the question is, what do we want to call a "Behaviorâ?
I would prefer isBehavior to return true for traits and rename the current isBehavior to isInstanciable for exemple. But this is quite a refactoring and itâs likely to break many things that are not in the image by default.
I would prefer any solution, as long as it is consistent. Other opinions?
Likewise in SystemDictionary and SystemNavigation:
All Classes and MetaClasses (-> Behavior allSubclasses)
-> allInstanciable or allClassesAndMetaclasses
All Classes and Traits
-> allInstanceSideBehaviors (and an equivalent allClassSideBehavior for metaclasses and classtraits)
All Classes and Traits and MetaClasses and ClassTraits
-> allBehaviors
All Classes and MetaClasses and some Traits?
not this one
(this of course, is related to http://forum.world.st/RBEnvironments-allClasses-Traits-Meta-tp4796370.html ).
In squeak Traits are behavior too.
Yes, itâs because in squeak traits are implemented differently: the class Trait inherits from Behavior so traits are instanciable.
nicolai