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! pf
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
There is no need for explicit requirement in Pharo because it was too static
Sorry, what do you mean by "too static"? Should I use "subclassresponsibility" in all cases (class and also traits)?
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
Hi Petr! You have found what I think is a bug. Indeed, Nautilus may be improved to have the behavior you describe. Having an explicit requirement ("self explicitRequirementâ) should be indicated by Nautilus. I suggest you to open a bug on https://pharo.fogbugz.com Regarding the second problem, I cannot reproduce it. Do you have the exact steps to reproduce it? Alexandre
On Aug 27, 2016, at 10:23 PM, Petr Fischer <petr.fischer@me.com> wrote:
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!
pf
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Today, after some work, I also noticed, that 2 methods from base trait was "copied" magicaly to the inherited trait (with same implementation as base trait) - I don't know why and when + Monticello is confused about trait method changes again... Bad thing is, these magic issues are nearly irreproducible, maybe later... With manual tweaking sometimes, I can still work further... I added bug/enhancement about Nautilus & explicitRequirement to the Pharo fogbuz. Thanks!
Hi Petr!
You have found what I think is a bug. Indeed, Nautilus may be improved to have the behavior you describe. Having an explicit requirement ("self explicitRequirementâ) should be indicated by Nautilus. I suggest you to open a bug on https://pharo.fogbugz.com
Regarding the second problem, I cannot reproduce it. Do you have the exact steps to reproduce it?
Alexandre
On Aug 27, 2016, at 10:23 PM, Petr Fischer <petr.fischer@me.com> wrote:
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!
pf
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Alex the explicitRequirement was removed because of the algorithms you need to check for example to update the icons or do static check each time you compile a method. Stef Le 28/8/16 à 11:17, Alexandre Bergel a écrit :
Hi Petr!
You have found what I think is a bug. Indeed, Nautilus may be improved to have the behavior you describe. Having an explicit requirement ("self explicitRequirementâ) should be indicated by Nautilus. I suggest you to open a bug on https://pharo.fogbugz.com
Regarding the second problem, I cannot reproduce it. Do you have the exact steps to reproduce it?
Alexandre
On Aug 27, 2016, at 10:23 PM, Petr Fischer <petr.fischer@me.com> wrote:
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!
pf
participants (3)
-
Alexandre Bergel -
Petr Fischer -
stepharo