[squeak-dev] The Trunk: Collections-cmm.531.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Sep 6 19:27:13 UTC 2013


Chris Muller uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-cmm.531.mcz

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

Name: Collections-cmm.531
Author: cmm
Time: 6 September 2013, 2:26:33.695 pm
UUID: da0031c2-e1d3-4f49-a425-9808728e3f1a
Ancestors: Collections-ul.530

- Remove redundant isVariableBinding override.
- Characters can now be tested for isAscii.
- Dictionary's and Set's made proxy-friendly.
- Remove redundant isLiteral override.
- Allow #asMutator to work for getter or setter selectors.

=============== Diff against Collections-ul.530 ===============

Item was removed:
- ----- Method: Association>>isVariableBinding (in category 'testing') -----
- isVariableBinding
- 	"Return true if I represent a literal variable binding"
- 	^true!

Item was added:
+ ----- Method: Character>>isAscii (in category 'testing') -----
+ isAscii
+ 	^ value between: 0 and: 128!

Item was changed:
  ----- Method: Dictionary>>keysSortedSafely (in category 'accessing') -----
  keysSortedSafely
  	"Answer a sorted Array containing the receiver's keys."
+ 	^ self keys sort:
+ 		[ : x : y | x compareSafely: y ]!
- 	
- 	 ^self keys sort: [ :x :y |
- 		"Should really be use <obj, string, num> compareSafely..."
- 		((x isString and: [ y isString ])
- 			or: [ x isNumber and: [ y isNumber ] ])
- 			ifTrue: [ x < y ]
- 			ifFalse: [ x class == y class
- 				ifTrue: [ x printString < y printString ]
- 				ifFalse: [ x class name < y class name ] ] ].
- !

Item was changed:
  ----- Method: Dictionary>>scanFor: (in category 'private') -----
  scanFor: anObject
  	"Scan the key array for the first slot containing either a nil (indicating an empty slot) or an element that matches anObject. Answer the index of that slot or raise an error if no slot is found. This method will be overridden in various subclasses that have different interpretations for matching elements."
  
  	| index start |
  	index := start := anObject hash \\ array size + 1.
  	[ 
  		| element |
+ 		((element := array at: index) == nil or: [ anObject = element key ])
- 		((element := array at: index) == nil or: [ element key = anObject ])
  			ifTrue: [ ^index ].
  		(index := index \\ array size + 1) = start ] whileFalse.
  	self errorNoFreeSpace!

Item was added:
+ ----- Method: Number>>compareSafely: (in category '*collections') -----
+ compareSafely: aNumber
+ 	"Override method to compare the receiver with aNumber to determine its position in a human-readable list without unnecessarily agitating proxies."
+ 	^ self < aNumber!

Item was added:
+ ----- Method: Object>>compareSafely: (in category '*collections') -----
+ compareSafely: anObject 
+ 	"Compare the receiver to anObject to determine its position in a human-readable list without unnecessarily agitating proxies."
+ 	^ self class = anObject class
+ 		ifTrue: [ self printString < anObject printString ]
+ 		ifFalse: [ self class name < anObject class name ]!

Item was changed:
  ----- Method: Set>>scanFor: (in category 'private') -----
  scanFor: anObject
  	"Scan the key array for the first slot containing either a nil (indicating an empty slot) or an element that matches anObject. Answer the index of that slot or raise an error if no slot is found. This method will be overridden in various subclasses that have different interpretations for matching elements."
  
  	| index start |
  	index := start := anObject hash \\ array size + 1.
  	[ 
  		| element |
+ 		((element := array at: index) == nil or: [ anObject = element enclosedSetElement ])
- 		((element := array at: index) == nil or: [ element enclosedSetElement = anObject ])
  			ifTrue: [ ^index ].
  		(index := index \\ array size + 1) = start ] whileFalse.
  	self errorNoFreeSpace!

Item was added:
+ ----- Method: String>>asAscii (in category 'converting') -----
+ asAscii
+ 	^ self select: [ : each | each isAscii ]!

Item was added:
+ ----- Method: String>>compareSafely: (in category '*collections') -----
+ compareSafely: aString 
+ 	"Compare the receiver to aString in a way that will not agitate proxies."
+ 	^ self < aString!

Item was changed:
+ ----- Method: String>>isLiteral (in category 'testing') -----
- ----- Method: String>>isLiteral (in category 'printing') -----
  isLiteral
+ 	"Answer whether the receiver is a valid Smalltalk literal."
  
+ 	^ true!
- 	^true!

Item was changed:
  ----- Method: Symbol>>asMutator (in category 'converting') -----
  asMutator
+ 	"Return a setter message from a getter message. For example, #name asMutator returns #name:"
+ 	^ self last = $:
+ 		ifTrue: [ self ]
+ 		ifFalse: [ (self copyWith: $:) asSymbol ]!
- 	"Return a setter message from a getter message. For example,
- 	#name asMutator returns #name:"
- 	^ (self copyWith: $:) asSymbol!

Item was removed:
- ----- Method: Symbol>>isLiteral (in category 'testing') -----
- isLiteral
- 	"Answer whether the receiver is a valid Smalltalk literal."
- 
- 	^ true!

Item was added:
+ ----- Method: Symbol>>veryDeepCopy (in category 'copying') -----
+ veryDeepCopy
+ 	"Overridden for performance."
+ 	^ self!



More information about the Squeak-dev mailing list