[Pharo-project] Questions on Traits

Marcus Denker marcus.denker at inria.fr
Tue Aug 14 11:47:55 CEST 2012


On Aug 13, 2012, at 10:50 PM, Mariano Martinez Peck <marianopeck at gmail.com> wrote:

> 
> 
> On Mon, Aug 13, 2012 at 4:36 PM, Marcus Denker <marcus.denker at inria.fr> wrote:
> 
> On Aug 13, 2012, at 4:31 PM, Noury Bouraqadi <bouraqadi at gmail.com> wrote:
> 
> > Hi,
> >
> > -Why new methods are compiled from the ones of traits? I remember that in the first implementation, when a trait was used by a class, new entries were introduced to the methodDict where the values  are the compiled methods from the trait. Currently, a new compiled method is introduced with the exact code of the on from the trait. Why?
> >
> Because you need to be able to somehow find the class and trait of a CompiledMethod. And that is encoded in it's literal array.
> 
> 
> Marcus, I cannot see where this is installed. Do you have an example?
> Let's use TEmptyTest with #testIfEmpty and SortedCollectionTest 
>  
> 

(TEmptyTest>>#testIfEmpty) methodClass 
		==> TEmptyTest

(TEmptyTest>>#testIfEmpty) origin 
		==> TEmptyTest

 (SortedCollectionTest>>#testIfEmpty) methodClass 
		==> SortedCollectionTest

 (SortedCollectionTest>>#testIfEmpty) origin 
		==> TEmptyTest




--
Marcus Denker -- http://marcusdenker.de




More information about the Pharo-project mailing list