[squeak-dev] The Inbox: Collections-ct.923.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Jan 24 15:53:45 UTC 2021


A new version of Collections was added to project The Inbox:
http://source.squeak.org/inbox/Collections-ct.923.mcz

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

Name: Collections-ct.923
Author: ct
Time: 24 January 2021, 4:53:44.716273 pm
UUID: bd630b83-a77e-cb4f-a008-246786a5c7d8
Ancestors: Collections-mt.919

Fixes printString representation of Associations and Dictionarys to avoid ambiguous selectors. As a consequence, reevalabuality is not limited any longer.

Examples:
	1 -> 2. "--> 1->2"
	1 -> -2. "--> 1 -> -2"
	Dictionary new at: -1 put: 1; at: 1 put: -1; yourself. "--> a Dictionary(-1->1 1 -> -1)"

=============== Diff against Collections-mt.919 ===============

Item was changed:
  ----- Method: Association>>printOn: (in category 'printing') -----
  printOn: aStream
+ 
  	| arrow |
  	super printOn: aStream.
+ 	
+ 	"Avoid AmbiguousSelector warnings when evaluating the stream as Smalltalk code."
+ 	arrow := ((key isSymbol and: [key isBinary])
+ 		or: [(value printStringLimitedTo: 1) beginsWith: '-'])
+ 			ifTrue: [' -> ']
+ 			ifFalse: ['->'].
- 	"If the key is a binary selector and we don't use whitespace, we will stream (key, '->') asSymbol."
- 	arrow := (key isSymbol and: [key isBinary]) ifTrue: [' -> '] ifFalse: ['->'].
  	aStream nextPutAll: arrow.
+ 	
+ 	value printOn: aStream.!
- 	value printOn: aStream!

Item was changed:
  ----- Method: Dictionary>>printElementsOn: (in category 'printing') -----
  printElementsOn: aStream 
  	aStream nextPut: $(.
  	self size > 100
  		ifTrue: [aStream nextPutAll: 'size '.
  			self size printOn: aStream]
  		ifFalse: [self keysInOrder
+ 				do: [:key | aStream print: (self associationAt: key)]
+ 				separatedBy: [aStream space]].
- 				do: [:key | aStream print: key;
- 						 nextPutAll: '->';				
- 						 print: (self at: key);
- 						 space]].
  	aStream nextPut: $)!



More information about the Squeak-dev mailing list