There is no need for explicit requirement in Pharo because it was too static
Le 28/8/16 à 03:23, Petr Fischer a écrit :
Hello, is Trait methods inheritance supported in Pharo?
Like this:
TBaseTrait>>myMethod
self subclassresponsibility
TSubTrait
uses: TBaseTrait
...
TSubTrait>>myMethod
some real implementation
MyClass
uses: TSubTrait
(MyClasss>>myMethod already implemented in TSubTrait, but I can reimplement
again)
Problems:
1) when I put "self subclassresponsibility" in TBaseTrait, everything is nicely visible in Nautilus browser
(something like "abstract" method with proper (a) yellow icon). But I read somewhere, that for traits, I must
use "^ self explicitRequirement" instead of "subclassresponsibility" - then, I can't see anything
usefull in Nautilus
2) sometimes (it was maybe with "self subclassresponsibility" in TBaseTrait),
Monticello not detected overrided TSubTrait>>myMethod (TSubTrait residing in another
package than TBaseTrait) and this overrided trait method in TSubTrait was not saved in
monticelo package (no changes was detected by Monticello, thus not saved to mcz package!)
So - is trait a "bag of methods" only, or is trait inheritance supported?
Thanks very much!
You can compose Traits and a class can uses Traits.
Now I remember that there is a little bug when we override a trait
method or something like that.
pf