Traits score: Squeak: 1, Pharo5: 0

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

Traits score: Squeak: 1, Pharo5: 0

HilaireFernandes
So it looks like Squeak[1] is capable to produce a correct .mcz file,
out of a package coming  with Traits and class.
By correct, read the Traits logic is not lost.

Hilaire

[1] I tested with a Squeak6 alpha waiting somewhere on my disk


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


Reply | Threaded
Open this post in threaded view
|

Re: Traits score: Squeak: 1, Pharo5: 0

HilaireFernandes
Tested on Pharo6, result is the same :(
Traits logic is lost when saving the package.

Squeak: 1 - Pharo6: 0


Le 14/04/2017 à 14:33, Hilaire a écrit :
> So it looks like Squeak[1] is capable to produce a correct .mcz file,
> out of a package coming  with Traits and class.
> By correct, read the Traits logic is not lost.
>
> Hilaire
>
> [1] I tested with a Squeak6 alpha waiting somewhere on my disk
>

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


Reply | Threaded
Open this post in threaded view
|

Re: Traits score: Squeak: 1, Pharo5: 0

Denis Kudriashov
Hi.

Could you create example set of packages to reproduce problem? (to be not dependant on your private code)

2017-04-14 14:41 GMT+02:00 Hilaire <[hidden email]>:
Tested on Pharo6, result is the same :(
Traits logic is lost when saving the package.

Squeak: 1 - Pharo6: 0


Le 14/04/2017 à 14:33, Hilaire a écrit :
> So it looks like Squeak[1] is capable to produce a correct .mcz file,
> out of a package coming  with Traits and class.
> By correct, read the Traits logic is not lost.
>
> Hilaire
>
> [1] I tested with a Squeak6 alpha waiting somewhere on my disk
>

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



Reply | Threaded
Open this post in threaded view
|

Re: Traits score: Squeak: 1, Pharo5: 0

HilaireFernandes
I tried but I can't reproduce the case with dummy code.
I can share privately an image though.

Hilaire

Le 14/04/2017 à 15:24, Denis Kudriashov a écrit :
>
> Could you create example set of packages to reproduce problem? (to be
> not dependant on your private code)
>

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


Reply | Threaded
Open this post in threaded view
|

Re: Traits score: Squeak: 1, Pharo5: 0

Nicolai Hess-3-2


2017-04-14 17:13 GMT+02:00 Hilaire <[hidden email]>:
I tried but I can't reproduce the case with dummy code.
I can share privately an image though.

Hilaire

Le 14/04/2017 à 15:24, Denis Kudriashov a écrit :
>
> Could you create example set of packages to reproduce problem? (to be
> not dependant on your private code)
>


How to reproduce:

"Create a Trait"
Trait named:#TRoot
uses:{} package:'MyPackage'.

"Add some methods"
(Smalltalk classOrTraitNamed:'TRoot') compile:'trootA'.
(Smalltalk classOrTraitNamed:'TRoot') compile:'trootB'.
(Smalltalk classOrTraitNamed:'TRoot') compile:'trootC'.

"Create another Trait using this Trait"
Trait named:#TRootUser
uses:{(Smalltalk classOrTraitNamed:'TRoot')} package:'MyPackage'.

"Add more methods.
Note, methods still added on TRoot"
(Smalltalk classOrTraitNamed:'TRoot') compile:'troot1'.
(Smalltalk classOrTraitNamed:'TRoot') compile:'troot2'.
(Smalltalk classOrTraitNamed:'TRoot') compile:'troot3'.

"Trait TRootUser should not have any local methods"
(RPackageOrganizer default packageNamed:'MyPackage') methods inspect.


Exprected outcome:
All methods are only defined on Trait TRoot.
Actual  outcome:
Methods from TRoot added before creating the Trait that uses TRoot, are *added* to the using trait, but only in the RPackage, the trait, *using* TRoot still *knows* that it does not hold any
local methods:

TRootUser localMethods.
->  "#()"
TRoot localMethods
-> "{TRoot>>#troot1. TRoot>>#troot3. TRoot>>#trootC. TRoot>>#trootB. TRoot>>#trootA. TRoot>>#troot2}"

Now, if we store a snapshot of this package, the RGMethodDefinitions, wrongly assigned to trait TRootUser, will be flattened into that trait.









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



Reply | Threaded
Open this post in threaded view
|

Re: Traits score: Squeak: 1, Pharo5: 0

HilaireFernandes
Great! It is nice you can reproduce it, because my attempt failed with
the exemple package attached.

Le 15/04/2017 à 08:14, Nicolai Hess a écrit :

>
>     Le 14/04/2017 à 15:24, Denis Kudriashov a écrit :
>     >
>     > Could you create example set of packages to reproduce problem? (to be
>     > not dependant on your private code)
>     >
>
>
> How to reproduce:
>
--
Dr. Geo
http://drgeo.eu

Traits-Bug-hf.4.mcz (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Traits score: Squeak: 1, Pharo5: 0

HilaireFernandes
In reply to this post by Nicolai Hess-3-2
Indeed that's it. Adding methods after the second traits was created
shows up the bug. I open a ticket.

https://pharo.fogbugz.com/f/cases/19938/Traits-methods-flattened


Le 15/04/2017 à 08:14, Nicolai Hess a écrit :
>
> How to reproduce:
>

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


Reply | Threaded
Open this post in threaded view
|

Re: Traits score: Squeak: 1, Pharo5: 0

CyrilFerlicot
In reply to this post by Nicolai Hess-3-2
Le 15/04/2017 à 08:14, Nicolai Hess a écrit :

> How to reproduce:
>
> "Create a Trait"
> Trait named:#TRoot
> uses:{} package:'MyPackage'.
>
> "Add some methods"
> (Smalltalk classOrTraitNamed:'TRoot') compile:'trootA'.
> (Smalltalk classOrTraitNamed:'TRoot') compile:'trootB'.
> (Smalltalk classOrTraitNamed:'TRoot') compile:'trootC'.
>
> "Create another Trait using this Trait"
> Trait named:#TRootUser
> uses:{(Smalltalk classOrTraitNamed:'TRoot')} package:'MyPackage'.
>
> "Add more methods.
> Note, methods still added on TRoot"
> (Smalltalk classOrTraitNamed:'TRoot') compile:'troot1'.
> (Smalltalk classOrTraitNamed:'TRoot') compile:'troot2'.
> (Smalltalk classOrTraitNamed:'TRoot') compile:'troot3'.
>
> "Trait TRootUser should not have any local methods"
> (RPackageOrganizer default packageNamed:'MyPackage') methods inspect.
>
>
> Exprected outcome:
> All methods are only defined on Trait TRoot.
> Actual  outcome:
> Methods from TRoot added before creating the Trait that uses TRoot, are
> *added* to the using trait, but only in the RPackage, the trait, *using*
> TRoot still *knows* that it does not hold any
> local methods:
>
> TRootUser localMethods.
> ->  "#()"
> TRoot localMethods
> -> "{TRoot>>#troot1. TRoot>>#troot3. TRoot>>#trootC. TRoot>>#trootB.
> TRoot>>#trootA. TRoot>>#troot2}"
>
> Now, if we store a snapshot of this package, the RGMethodDefinitions,
> wrongly assigned to trait TRootUser, will be flattened into that trait.
>
>
This is cool that it was found with a reproducible case. We got the same
problem at Synectique.

--
Cyril Ferlicot
https://ferlicot.fr

http://www.synectique.eu
2 rue Jacques Prévert 01,
59650 Villeneuve d'ascq France


signature.asc (836 bytes) Download Attachment