How to add a TraitExclusion to used Trait

Juraj Kubelka Juraj.Kubelka at gmail.com
Sun Aug 26 13:26:03 UTC 2007


I found a solution:

T4 traitComposition traits select: [ :each | each canUnderstand:  
#method1 ].
aTrait := T4 traitComposition copyWithExclusionOf: #method1 to: T2.
T4 setTraitComposition: aTrait asTraitComposition.

Thanks.
Juraj

On 23.8.2007, at 21:07, Juraj Kubelka wrote:

> Hi everybody!
>
> Let's say there is:
>
> Trait named: #T1
> 	uses: {}
> 	category: 'Example'
>
> Trait named: #T2
> 	uses: T1
> 	category: 'Example'
>
> T1>>method1.
> T1>>method2.
>
> And I would like to recompile T2:
>
> Trait named: #T2
> 	uses: T1 - {#method1}
> 	category: 'Example'
>
> Do you have an idea how to exclude #method1?
> Something like:
>
> T2 excludeSelector: #method1.
>
> I would like to use it in such situation:
>
> If user has selected T2>>method1 in a System Browser and wants to  
> remove the method, system will ask:
>
> '#method1 comes from used trait T1. Would you like to:'
>  - Remove method from trait T1.
>  - Exclude method from T2'
>  - Cancel
>
> Thank in advance.
> Juraj
>




More information about the Squeak-dev mailing list