I've fixed this issue in Pharo a couple of months ago. CompiledMethods are not shared anymore, so methodClass returns the expected class. At the time I implemented traits (2004?), there were no method properties and hence sharing compiled methods worked -- of course except for super sends in which case the method was always recompiled (so the answer to Andreas' question below is b)).
Cheers, Adrian On Oct 21, 2009, at 08:42 , Andreas Raab wrote: > Igor Stasenko wrote: >> now what i found interesting: >> (ABBAB methodDict at: #foo) == (ABBAC methodDict at: #foo) >> but as side effect, we got this one: >> (ABBAB methodDict at: #foo) methodClass ==> ABBAC >> which i find a bit disturbing :( > > Yes, seems wrong. VERY wrong. Try this: > > Object subclass: #BaseA > > BaseA>>foo > ^42 > > Object subclass: #BaseB > > BaseB>>foo > ^13 > > And then create subclasses of BaseA and BaseB which use your trait > and have the trait implementation use "^super foo". One of two > things should happen: > > a) They both return the same (incorrect) value (which would be > expected if methodClass is the same). In this case it's just plain > broken. > > b) They both return different values, in which case there is code > that handles super sends specifically and the sharing is simply an > unnecessary optimization. > > I hope it's the latter case which would mean you only need to throw > out the test for super sends and do whatever that code was doing to > begin with ;-) > > Cheers, > - Andreas > > _______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
