[Pkg] The Trunk: Traits-cwp.293.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Apr 29 18:08:50 UTC 2013


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

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

Name: Traits-cwp.293
Author: cwp
Time: 29 April 2013, 11:07:42.535 am
UUID: f3c6cade-2e61-41c9-904d-9c77f00030a8
Ancestors: Traits-cwp.292

When registering a Trait, catch and resume AttemptToWriteReadOnlyGlobal, since there may already be a class binding.

=============== Diff against Traits-cwp.292 ===============

Item was changed:
  ----- Method: Trait>>setName:andRegisterInCategory:environment: (in category 'initialize') -----
  setName: aSymbol andRegisterInCategory: categorySymbol environment: aSystemDictionary
  	(self isValidTraitName: aSymbol) ifFalse: [self error:'Invalid trait name'].
  
  	(self environment == aSystemDictionary
  		and: [self name = aSymbol
  			and: [self category = categorySymbol]]) ifTrue: [^self].
  		
  	((aSystemDictionary includesKey: aSymbol) and: [(aSystemDictionary at: aSymbol) ~~ self])
  		ifTrue: [self error: 'The name ''' , aSymbol , ''' is already used'].
  
  	(self environment notNil and: [self name notNil and: [self name ~= aSymbol]]) ifTrue: [
  		self environment renameClass: self as: aSymbol].
  	
  	self name: aSymbol.
  	self environment: aSystemDictionary.	
+ 	[self environment at: self name put: self]
+ 		on: AttemptToWriteReadOnlyGlobal
+ 		do: [:n | n resume: true].
- 	self environment at: self name put: self.
  	self environment organization classify: self name under: categorySymbol.
  	^ true!



More information about the Packages mailing list