[squeak-dev] The Inbox: Collections-cmm.858.mcz
marcel.taeumel at hpi.de
Tue Nov 5 07:41:14 UTC 2019
+1 for adding #keysInOrder and using it in #printElementsOn:.
-1 for choosing 'printing' as category of #keysInOrder (and #keysSortedSafely). Maybe 'accessing' instead?
-1 for not having a comment in #keysInOrder ... could you explain the idea of "order" in contrast to "as is" with just a few words? :-) So that one can figure out when to use #keysSortedSafely and when to pick #keysInOrder
Hmmm... does "keys in order" sound almost like "are keys in order" and thus like a boolean result? I have no idea. :-D Did you also consider "keysOrdered" or "orderedKeys"? Just thinking about Color class >> #orderedCrayonColors.
Anyway, good idea. :-) I suppose that even if this method is used in any serialization format, the order would not harm the integrity of the contents.
Am 05.11.2019 02:25:27 schrieb commits at source.squeak.org <commits at source.squeak.org>:
Chris Muller uploaded a new version of Collections to project The Inbox:
==================== Summary ====================
Time: 4 November 2019, 7:25:14.227142 pm
Let the printString of an OrderedDictionary reveal its key sequence.
=============== Diff against Collections-pre.857 ===============
Item was added:
+ ----- Method: Dictionary>>keysInOrder (in category 'printing') -----
+ ^ self keysSortedSafely!
Item was changed:
----- Method: Dictionary>>printElementsOn: (in category 'printing') -----
aStream nextPut: $(.
self size > 100
ifTrue: [aStream nextPutAll: 'size '.
self size printOn: aStream]
+ ifFalse: [self keysInOrder
- ifFalse: [self keysSortedSafely
do: [:key | aStream print: key;
print: (self at: key);
aStream nextPut: $)!
Item was added:
+ ----- Method: OrderedDictionary>>keysInOrder (in category 'printing') -----
+ ^ self keys!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Squeak-dev