Questions on Traits

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Questions on Traits

Noury Bouraqadi-2
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?

-It is possible to compile a method that includes a super send in traits. Does it make sense?

Noury
--
http://twitter.com/#!/NouryBouraqadi
http://www.kroobe.com/profile/noury


Afin de contribuer au respect de l'environnement,
merci de n'imprimer ce courriel qu'en cas de necessite

Please consider the environment before you print




Reply | Threaded
Open this post in threaded view
|

Re: Questions on Traits

Marcus Denker-4

On Aug 13, 2012, at 4:31 PM, Noury Bouraqadi <[hidden email]> 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.

The old implemention, you got random answers (depending on what happend to be found finst by #who).

Compiling new methods makes it much cleaner.


        Marcus


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


Reply | Threaded
Open this post in threaded view
|

Re: Questions on Traits

Mariano Martinez Peck


On Mon, Aug 13, 2012 at 4:36 PM, Marcus Denker <[hidden email]> wrote:

On Aug 13, 2012, at 4:31 PM, Noury Bouraqadi <[hidden email]> 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 
 

The old implemention, you got random answers (depending on what happend to be found finst by #who).

Compiling new methods makes it much cleaner.


        Marcus


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





--
Mariano
http://marianopeck.wordpress.com

Reply | Threaded
Open this post in threaded view
|

Re: Questions on Traits

Marcus Denker-4

On Aug 13, 2012, at 10:50 PM, Mariano Martinez Peck <[hidden email]> wrote:

>
>
> On Mon, Aug 13, 2012 at 4:36 PM, Marcus Denker <[hidden email]> wrote:
>
> On Aug 13, 2012, at 4:31 PM, Noury Bouraqadi <[hidden email]> 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


Reply | Threaded
Open this post in threaded view
|

Re: Questions on Traits

Stéphane Ducasse
In reply to this post by Noury Bouraqadi-2

On Aug 13, 2012, at 4:31 PM, Noury Bouraqadi 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?
>
> -It is possible to compile a method that includes a super send in traits. Does it make sense?

I think yes. But indeed the application of the trait should rebind the "super" encoding

Stef


>
> Noury
> --
> http://twitter.com/#!/NouryBouraqadi
> http://www.kroobe.com/profile/noury
>
>
> Afin de contribuer au respect de l'environnement,
> merci de n'imprimer ce courriel qu'en cas de necessite
>
> Please consider the environment before you print
>
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Questions on Traits

Marcus Denker-4

On Aug 14, 2012, at 12:11 PM, Stéphane Ducasse <[hidden email]> wrote:

>
> On Aug 13, 2012, at 4:31 PM, Noury Bouraqadi 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?
>>
>> -It is possible to compile a method that includes a super send in traits. Does it make sense?
>
> I think yes. But indeed the application of the trait should rebind the "super" encoding
>

for super sends, the vm looks at the same literal that is returned when calling #methodClass.

So this means that due to updating that, the super sends will just work.

        Marcus


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