Mantis - Squeak
Viewing Issue Advanced Details
6534 Traits minor always 06-09-07 12:17 06-14-07 07:02
Damien Cassou  
assigned 3.9  
0006534: Trait required methods take precedence over super class implementation
   self explicitRequirement

A is a subclass of Object, NOT using T1

   self doSomething

B is a subclass of A using T1

In B, f is still a requirement even if implemented in the superclass. This is because methods in trait T1 take precedence over methods in the superclass. This should not be the case with required methods.

06-09-07 15:02   
I disagree this is a bug. Trait methods are defined to be considered as belonging to the class using them, therefore they override inherited classes. The conclusion is that having explicit requirements is a bad idea. This is reinforced by the existence of an incremental browser that detects requirements automatically, without them being declared...
06-14-07 07:02   
"self explicitRequirement" is a representation of what the Traits formal model calls bottom. Bottom meet X = X for all X. So in this case, B >> #f should be self doSomething.

What is most likely going on here is that the implementation is (1) using a real method for self explicitRequirment, and (2) failing to check for it when composing the trait.