Traits, method flatten

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Traits, method flatten

HilaireFernandes
Hi,

When I load with Monticello classes with traits, all the traits methods
are duplicated in the class.

I got this problem with 4.0 then now with 5.0

Hilaire

--
Dr. Geo
http://drgeo.eu


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Traits, method flatten

Stephane Ducasse-3
can you show us the code?


On Tue, Apr 11, 2017 at 7:08 PM, Hilaire <[hidden email]> wrote:
Hi,

When I load with Monticello classes with traits, all the traits methods
are duplicated in the class.

I got this problem with 4.0 then now with 5.0

Hilaire

--
Dr. Geo
http://drgeo.eu



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Traits, method flatten

HilaireFernandes
Privately only, and I have to recover from old version, but then when
saving, then reloading it is flatten :((
With Pharo5

Le 11/04/2017 à 20:43, Stephane Ducasse a écrit :
> can you show us the code?
>

--
Dr. Geo
http://drgeo.eu


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Traits, method flatten

HilaireFernandes
In reply to this post by HilaireFernandes
Investigating a bit on the mater, here is the conduct:

- In a fresh 5.0, find an a version of my package where the Traits logic
is not compromised (All traits methods are not duplicated in the classes
using the traits)

- Load this package, all seems fine.

- Promote the class/trait category to a package, let's say TraitsPackage

- Save this package locally in a .mcz file

- In the Pharo5.0 image unload all my packages

- Load back the TraitsPackage, all traits methods are duplicated...

- Examine the source in the .mcz file: the traits logic is already
compromised


Is there anything wrong in this process?


Conclusion1: Pharo5 does not know how to save Trait  correctly.
Conclusion2: Already get there,
http://forum.world.st/Strange-behaviour-with-traits-td4891623.html

Hilaire


--
Dr. Geo
http://drgeo.eu


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Traits, method flatten

HilaireFernandes
Hi,

If anyone with deep knowledge on Monticello wants to give a look with
this bugs on Traits, I can share privately an image exposing the
problem. Just mail me at hilaire [AT] drgeo.eu

Thanks

Hilaire

Le 12/04/2017 à 14:08, Hilaire a écrit :

> Investigating a bit on the mater, here is the conduct:
>
> - In a fresh 5.0, find an a version of my package where the Traits logic
> is not compromised (All traits methods are not duplicated in the classes
> using the traits)
>
> - Load this package, all seems fine.
>
> - Promote the class/trait category to a package, let's say TraitsPackage
>
> - Save this package locally in a .mcz file
>
> - In the Pharo5.0 image unload all my packages
>
> - Load back the TraitsPackage, all traits methods are duplicated...
>
> - Examine the source in the .mcz file: the traits logic is already
> compromised
>
>
> Is there anything wrong in this process?
>
>
> Conclusion1: Pharo5 does not know how to save Trait  correctly.
> Conclusion2: Already get there,
> http://forum.world.st/Strange-behaviour-with-traits-td4891623.html

--
Dr. Geo
http://drgeo.eu


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Traits, method flatten

Nicolai Hess-3-2

I am interested, and I  think I already looked at this issue, I vaguely remember, that this has
something to do with the determination of the origin of a method (trait methods that are from another trait
are wrongly recognized as (trait)local methods).

2017-04-13 8:37 GMT+02:00 Hilaire <[hidden email]>:
Hi,

If anyone with deep knowledge on Monticello wants to give a look with
this bugs on Traits, I can share privately an image exposing the
problem. Just mail me at hilaire [AT] drgeo.eu

Thanks

Hilaire

Le 12/04/2017 à 14:08, Hilaire a écrit :
> Investigating a bit on the mater, here is the conduct:
>
> - In a fresh 5.0, find an a version of my package where the Traits logic
> is not compromised (All traits methods are not duplicated in the classes
> using the traits)
>
> - Load this package, all seems fine.
>
> - Promote the class/trait category to a package, let's say TraitsPackage
>
> - Save this package locally in a .mcz file
>
> - In the Pharo5.0 image unload all my packages
>
> - Load back the TraitsPackage, all traits methods are duplicated...
>
> - Examine the source in the .mcz file: the traits logic is already
> compromised
>
>
> Is there anything wrong in this process?
>
>
> Conclusion1: Pharo5 does not know how to save Trait  correctly.
> Conclusion2: Already get there,
> http://forum.world.st/Strange-behaviour-with-traits-td4891623.html

--
Dr. Geo
http://drgeo.eu



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Traits, method flatten

HilaireFernandes
What is your email address? I can't read it from the usenet forum.

Hilaire

Le 13/04/2017 à 08:53, Nicolai Hess a écrit :
>
> I am interested, and I  think I already looked at this issue, I vaguely
> remember, that this has
> something to do with the determination of the origin of a method (trait
> methods that are from another trait
> are wrongly recognized as (trait)local methods).
>

--
Dr. Geo
http://drgeo.eu


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Traits, method flatten

HilaireFernandes
In reply to this post by Nicolai Hess-3-2
May be an important note, FileOut is handling just right the Traits logic.

Hilaire


Le 13/04/2017 à 08:53, Nicolai Hess a écrit :
>
> I am interested, and I  think I already looked at this issue, I vaguely
> remember, that this has
> something to do with the determination of the origin of a method (trait
> methods that are from another trait
> are wrongly recognized as (trait)local methods).
>

--
Dr. Geo
http://drgeo.eu


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Traits, method flatten

HilaireFernandes
On a restored Traits logic of my package, I made another attempt to
persist this time with filetree://. The net result is the same, the
Traits logic is lost in the classes using the Traits: all traits methods
are duplicated !!

To sum up, package saved with the following methods:

- *.mcz package with the traits got broken. The .st source file is
~207kB of mostly duplicated methods

- filetree package got broken too

- Brave old fileout handles it just fine :) with Pharo5 (Pharo4 has UTF8
characters issues) . Source file is about 40KB


Solutions:

- Get it fixed. The problem is there since Pharo3 or 4... Not sure where
to look at.

- Escape from Traits :(

- Test on Squeak, not sure how stable it is there...

- Use fileout + CVS to persist code.

Hilaire


Le 13/04/2017 à 09:44, Hilaire a écrit :

> May be an important note, FileOut is handling just right the Traits logic.
>
> Hilaire
>
>
> Le 13/04/2017 à 08:53, Nicolai Hess a écrit :
>> I am interested, and I  think I already looked at this issue, I vaguely
>> remember, that this has
>> something to do with the determination of the origin of a method (trait
>> methods that are from another trait
>> are wrongly recognized as (trait)local methods).
>>

--
Dr. Geo
http://drgeo.eu


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Traits, method flatten

HilaireFernandes
Give a try to filein the correct .st source file of the Traits+Classes
package. It does not get it right :(

Pharo5 get it right when loading the .st source file though.

Still investigating...

Le 14/04/2017 à 11:04, Hilaire a écrit :
> - Test on Squeak, not sure how stable it is there...

--
Dr. Geo
http://drgeo.eu


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Traits, method flatten

HilaireFernandes
Ah, no my bad. Squeak was file in correctly the Trait and Class, it is
just that its browser does not let you know if a method class belong to
one of its Traits or the class itself

Le 14/04/2017 à 11:16, Hilaire a écrit :
> Give a try to filein the correct .st source file of the Traits+Classes
> package. It does not get it right :(
>
> Pharo5 get it right when loading the .st source file though.
>
> Still investigating...

--
Dr. Geo
http://drgeo.eu


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Traits, method flatten

Sean P. DeNigris
Administrator
In reply to this post by HilaireFernandes
HilaireFernandes wrote
I made another attempt to
persist this time with filetree://. The net result is the same, the
Traits logic is lost in the classes using the Traits: all traits methods
are duplicated !!
I just got burned by this in ##50768. Methods inherited from traits were saved as part of the package containing the extended class, as well as the package containing the Trait itself. Ugh. Was this ever fixed by Pharo 6?
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Traits, method flatten

Nicolai Hess-3-2


2017-06-08 6:00 GMT+02:00 Sean P. DeNigris <[hidden email]>:
HilaireFernandes wrote
> I made another attempt to
> persist this time with filetree://. The net result is the same, the
> Traits logic is lost in the classes using the Traits: all traits methods
> are duplicated !!

I just got burned by this in ##50768. Methods inherited from traits were
saved as part of the package containing the extended class, as well as the
package containing the Trait itself. Ugh. Was this ever fixed by Pharo 6?

yes, it should. See issue
 19938 Traits methods flattened (now in Pharo 60466 )
19974 backport Traits methods flattened (case 19938)  (now in Pharo 50772 )

But AFAIK the bug, that new trait methotds are put into the "RPackage" of the trait that is "using" this trait , still exists.
We only reject this entities when building the mc-package

 



-----
Cheers,
Sean
--
View this message in context: http://forum.world.st/Traits-method-flatten-tp4941799p4950378.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Traits, method flatten

HilaireFernandes
In reply to this post by Sean P. DeNigris
Yes, Nicolai proposed a fix, and it worked well enough. So it should
make you happy.

Hilaire


Le 08/06/2017 à 06:00, Sean P. DeNigris a écrit :
> HilaireFernandes wrote
>> I made another attempt to
>> persist this time with filetree://. The net result is the same, the
>> Traits logic is lost in the classes using the Traits: all traits methods
>> are duplicated !!
> I just got burned by this in ##50768. Methods inherited from traits were
> saved as part of the package containing the extended class, as well as the
> package containing the Trait itself. Ugh. Was this ever fixed by Pharo 6?
>

--
Dr. Geo
http://drgeo.eu



Loading...