The Trunk: Traits-cwp.301.mcz

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

The Trunk: Traits-cwp.301.mcz

commits-2
Colin Putney uploaded a new version of Traits to project The Trunk:
http://source.squeak.org/trunk/Traits-cwp.301.mcz

==================== Summary ====================

Name: Traits-cwp.301
Author: cwp
Time: 10 January 2014, 10:21:42.335 am
UUID: 4d29a1a0-5d8b-4439-a082-e42b5e69efc9
Ancestors: Traits-nice.300

Implement Trait>>unload, for better polymorphism with classes.

=============== Diff against Traits-nice.300 ===============

Item was added:
+ ----- Method: Trait>>unload (in category 'initialize') -----
+ unload
+ "For polymorphism with classes. Do nothing"!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Traits-cwp.301.mcz

Frank Shearar-3
On 10 January 2014 15:22,  <[hidden email]> wrote:

> Colin Putney uploaded a new version of Traits to project The Trunk:
> http://source.squeak.org/trunk/Traits-cwp.301.mcz
>
> ==================== Summary ====================
>
> Name: Traits-cwp.301
> Author: cwp
> Time: 10 January 2014, 10:21:42.335 am
> UUID: 4d29a1a0-5d8b-4439-a082-e42b5e69efc9
> Ancestors: Traits-nice.300
>
> Implement Trait>>unload, for better polymorphism with classes.
>
> =============== Diff against Traits-nice.300 ===============
>
> Item was added:
> + ----- Method: Trait>>unload (in category 'initialize') -----
> + unload
> +       "For polymorphism with classes. Do nothing"!

Might be worth pointing the reader to the custom Trait unloader?

frank

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Traits-cwp.301.mcz

Colin Putney-3



On Fri, Jan 10, 2014 at 10:33 AM, Frank Shearar <[hidden email]> wrote:
 
 Might be worth pointing the reader to the custom Trait unloader?

Perhaps... want to point me to the custom Trait unloader? :-)


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Traits-cwp.301.mcz

Frank Shearar-3
On 10 January 2014 15:45, Colin Putney <[hidden email]> wrote:

>
>
>
> On Fri, Jan 10, 2014 at 10:33 AM, Frank Shearar <[hidden email]>
> wrote:
>
>>
>>  Might be worth pointing the reader to the custom Trait unloader?
>
>
> Perhaps... want to point me to the custom Trait unloader? :-)

Trait class >> #unloadTraits :)

frank

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Traits-cwp.301.mcz

Colin Putney-3



On Fri, Jan 10, 2014 at 10:56 AM, Frank Shearar <[hidden email]> wrote:
 
Trait class >> #unloadTraits :)

Ah, but that's for removing the Traits package. (Incidentally, I haven't been able to make that work.)

This change is about making it easier to remove packages that include traits. PackageInfo>>classes includes Trait instances in its responses, and without this method, you have to check each one to see if it's a real class before sending #unload.

 


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Traits-cwp.301.mcz

Frank Shearar-3
On 10 January 2014 16:11, Colin Putney <[hidden email]> wrote:

>
>
>
> On Fri, Jan 10, 2014 at 10:56 AM, Frank Shearar <[hidden email]>
> wrote:
>
>>
>> Trait class >> #unloadTraits :)
>
>
> Ah, but that's for removing the Traits package. (Incidentally, I haven't
> been able to make that work.)
>
> This change is about making it easier to remove packages that include
> traits. PackageInfo>>classes includes Trait instances in its responses, and
> without this method, you have to check each one to see if it's a real class
> before sending #unload.

D'oh. Yes. You're quite right. #unload's for a class, not a package.

frank

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Traits-cwp.301.mcz

David T. Lewis
In reply to this post by Colin Putney-3
On Fri, Jan 10, 2014 at 11:11:49AM -0500, Colin Putney wrote:
> On Fri, Jan 10, 2014 at 10:56 AM, Frank Shearar <[hidden email]>wrote:
>
>
> > Trait class >> #unloadTraits :)
> >
>
> Ah, but that's for removing the Traits package. (Incidentally, I haven't
> been able to make that work.)

Sorry I have not been keeping up with all this excellent work, but I do
want to mention that one of the things that makes Andreas' Traits for Squeak
so important is that is fully reloadable. So it is really good that you are
working on this, thank you!

Dave


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Traits-cwp.301.mcz

Frank Shearar-3
In reply to this post by commits-2
On 10 January 2014 15:22,  <[hidden email]> wrote:

> Colin Putney uploaded a new version of Traits to project The Trunk:
> http://source.squeak.org/trunk/Traits-cwp.301.mcz
>
> ==================== Summary ====================
>
> Name: Traits-cwp.301
> Author: cwp
> Time: 10 January 2014, 10:21:42.335 am
> UUID: 4d29a1a0-5d8b-4439-a082-e42b5e69efc9
> Ancestors: Traits-nice.300
>
> Implement Trait>>unload, for better polymorphism with classes.
>
> =============== Diff against Traits-nice.300 ===============
>
> Item was added:
> + ----- Method: Trait>>unload (in category 'initialize') -----
> + unload
> +       "For polymorphism with classes. Do nothing"!

A second time, with my brain in gear. It is possible to make this
actually unload the Trait and do something useful: flatten the Trait
into all its users. Trait class >> #removeAllTraits does this when
Traits is unloaded. One tricky thing is that #removeAllTraits flattens
_all_ Traits used by a class. So if class Foo uses TBar and TBaz,
"TBar unload" ought to flatten TBar's methods, and not TBaz's.

If that gets implemented, that is.

frank

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Traits-cwp.301.mcz

Tobias Pape

On 11.01.2014, at 15:19, Frank Shearar <[hidden email]> wrote:

> On 10 January 2014 15:22,  <[hidden email]> wrote:
>> Colin Putney uploaded a new version of Traits to project The Trunk:
>> http://source.squeak.org/trunk/Traits-cwp.301.mcz
>>
>> ==================== Summary ====================
>>
>> Name: Traits-cwp.301
>> Author: cwp
>> Time: 10 January 2014, 10:21:42.335 am
>> UUID: 4d29a1a0-5d8b-4439-a082-e42b5e69efc9
>> Ancestors: Traits-nice.300
>>
>> Implement Trait>>unload, for better polymorphism with classes.
>>
>> =============== Diff against Traits-nice.300 ===============
>>
>> Item was added:
>> + ----- Method: Trait>>unload (in category 'initialize') -----
>> + unload
>> +       "For polymorphism with classes. Do nothing"!
>
> A second time, with my brain in gear. It is possible to make this
> actually unload the Trait and do something useful: flatten the Trait
> into all its users. Trait class >> #removeAllTraits does this when
> Traits is unloaded. One tricky thing is that #removeAllTraits flattens
> _all_ Traits used by a class. So if class Foo uses TBar and TBaz,
> "TBar unload" ought to flatten TBar's methods, and not TBaz's.
>
> If that gets implemented, that is.
>
I think this should be explicit.
I mean, if you unload a class, it is not like its functionality
is folded into all its users. Hence, I think we could have:
• #unload as of now
• #flatten to fold functionality into its clients
• #flattenAndUnload to do both…

Best
        -Tobias

PS: The flatten implementation could be useful, eg, to make it possible to
    flatten-ly load Squeak/Pharo mcz that use traits into gemstone.
    (I always wanted to do that…)




signature.asc (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Traits-cwp.301.mcz

Colin Putney-3
In reply to this post by Frank Shearar-3



On Sat, Jan 11, 2014 at 9:19 AM, Frank Shearar <[hidden email]> wrote:
 
A second time, with my brain in gear. It is possible to make this
actually unload the Trait and do something useful: flatten the Trait
into all its users. Trait class >> #removeAllTraits does this when
Traits is unloaded. One tricky thing is that #removeAllTraits flattens
_all_ Traits used by a class. So if class Foo uses TBar and TBaz,
"TBar unload" ought to flatten TBar's methods, and not TBaz's.

Well, #unload is a bit of a misnomer. MCPackage>>unload does what it says, but most implementors don't remove themselves from the system, they just prepare to be removed. That typically means unregistering from menus or flaps, cancelling notifications and so on. 

So if Trait>>flatten were implemented per Tobias' suggestion, then Trait>>unload could call that. 

Colin