[squeak-dev] The Inbox: Traits-pre.307.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Nov 20 13:58:19 UTC 2015


A new version of Traits was added to project The Inbox:
http://source.squeak.org/inbox/Traits-pre.307.mcz

==================== 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 http://bugs.squeak.org/view.php?id=7767 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.

=============== Diff against Traits-eem.306 ===============

Item was changed:
  ----- Method: TraitAlias>>printOn: (in category 'operations') -----
  printOn: s
  	"Answer the trait composition string (used for class definitions)"
+ 	s nextPutAll: '('.
  	s nextPutAll: subject asString.
  	s nextPutAll: ' @ {'.
  	aliases do:[:assoc| s print: assoc] separatedBy:[s nextPutAll:'. '].
  	s nextPutAll: '}'.
+ 	s nextPutAll: ')'.!
- !

Item was changed:
  ----- Method: TraitComposition>>- (in category 'converting') -----
  - anArray
- 	"the modifier operators #@ and #- bind stronger than +.
- 	Thus, #@ or #- sent to a sum will only affect the most right summand"
  	
+ 	self updateTraits: (self traitsCollect: [:aTrait | aTrait - anArray ])!
- 	self addLast: (self removeLast - anArray)!

Item was changed:
  ----- Method: TraitComposition>>@ (in category 'converting') -----
  @ anArrayOfAssociations
+ 	
+ 	self updateTraits: (self traitsCollect: [:aTrait | aTrait @ anArrayOfAssociations ])!
- 	"the modifier operators #@ and #- bind stronger than +.
- 	Thus, #@ or #- sent to a sum will only affect the most right summand"
- 
- 	self addLast: (self removeLast @ anArrayOfAssociations)!

Item was added:
+ ----- Method: TraitComposition>>traitsCollect: (in category 'accessing') -----
+ traitsCollect: aBlock
+ 	^self collect: [:each| each traitsDo: aBlock]!

Item was changed:
  ----- Method: TraitComposition>>traitsDo: (in category 'accessing') -----
  traitsDo: aBlock
+ 	^self do: [:each| each traitsDo: aBlock]!
- 	^self do:[:each| each traitsDo: aBlock]!

Item was added:
+ ----- Method: TraitComposition>>updateTraits: (in category 'converting') -----
+ updateTraits: aCollection
+ 
+ 	self
+ 		removeAll;
+ 		addAll: aCollection!

Item was changed:
  ----- Method: TraitExclusion>>printOn: (in category 'composition') -----
  printOn: aStream
  	"Answer the trait composition string (used for class definitions)"
+ 	aStream nextPutAll: '('.
  	aStream nextPutAll: subject asString.
  	aStream nextPutAll: ' - {'.
  	exclusions asArray sort do:[:exc| aStream store: exc] separatedBy:[aStream nextPutAll: '. '].
+ 	aStream nextPutAll: '}'.
+ 	aStream nextPutAll: ')'.!
- 	aStream nextPutAll: '}'.!



More information about the Squeak-dev mailing list