Mantis - Squeak
Viewing Issue Advanced Details
7767 Traits minor always 06-04-13 13:43 07-03-16 04:29
resolved trunk  
0007767: - does not respect brackets
In the composition (S + T) - m, where m is a set of excluded selectors, m is not removed from the TraitComposition (S + T), but only from T.

11-18-15 15:21   
Does anyone have a strong opinion on this one? The behavior was intended like that as can be seen in this method:

TraitComposition>>#- anArray
    "the modifier operators #@ and #- bind stronger than +.
    Thus, #@ or #- sent to a sum will only affect the most right summand"
    self addLast: (self removeLast - anArray)

However, this violates the normal evaluation order of Squeak Smalltalk, so I would propose, that we remove this behavior.
11-18-15 15:29   
I asked the Pharo guys (where most of the people who wrote the papers on Traits hang out), and their reply is here: [^]

The gist? It's a bug.
11-18-15 15:42   
Thanks for the hint :)

So, I am going to change this to the Pharo equivalent but without the comment which is kind of confusing, as the behavior does not look like #- would bind stronger than #+ anymore.

- anArray
    "the modifier operators #@ and #- bind stronger than +"
    self transformations: (self transformations collect: [ :t | t - anArray ])
07-03-16 04:29   
Patrick Rein uploaded a new version of Traits to project The Trunk: [^]
==================== Summary ====================
Name: Traits-pre.307
Author: pre
Time: 20 November 2015, 2:58:26.562 pm
UUID: f0955b2d-775c-4862-85b9-5d6e616cd2e4
Ancestors: Traits-eem.306
This fixes [^] which is about the - and @ operator of Trait compositions ignoring brackets. This implementation uses the
+normal left to right evaluation order of Smalltalk to avoid confusions about the way trait composition expressions are evaluated.