Hi all, I'm doing some work with traits, and I found something like this case:
Trait T1>>m1 ^self requirement
Trait T2>>m1 doSomeStuff
Class C1 uses: T1 + T2 [note, i'm not excluding m1 from T1 in the T1 + T2 composition.] And the resulting: C1>>m1 doSomeStuff
It is just ok, since the other m1 is just a mark for a requiredMethod, but I find this a little weird, since do not follow the Trait definition. (at least the one I read, maybe it changed!). Wouldn't be better to automatically add the exclusion at the composition? Class C1 uses: T1 - {#m1} + T2
not really. Or this means that the composition algo does not work well. Now since C1 redefined m1 in both cases you will have C>>m1 taking precedence over T1>>m1. I already forget but I discussed with tom and in javascript it proposed a different one than the ones we have in smalltalk and it was coherent too. Now there is a bug in pharo and squeak3.9 because if C1 is in fact the superclass of the class using the trait then the requirement is not considered as fullfiled or something like that.]
In this way the definition would be followed without any exception (and it will be explicit with what is going on). This is just a suggestion, anyway it works great!
btw... why there are two requirement marks?: Object>>requirement self error: 'Implicitly required method'
Object>>explicitRequirement self error: 'Explicitly required method'
the question is, if I use #requirement, I'm explicitly requiring that method. Is there any situation where I should use #requirement?
I do not remember.
Cheers
-- View this message in context: http://forum.world.st/trait-composition-conflict-autoresolution-tp2235790p22... Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project