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

Levente Uzonyi leves at elte.hu
Sat Sep 7 00:56:43 UTC 2013


On Fri, 6 Sep 2013, commits at source.squeak.org wrote:

> 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.

What about the other Sets and Dictionaries?

> - Remove redundant isLiteral override.
> - Allow #asMutator to work for getter or setter selectors.
>
> =============== Diff against Collections-ul.530 ===============
>
> 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!

You assume that the argument is a Number, but you don't check if it really 
is a Number or not. If it's not, then you must use the implemtation in
Object.

> 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!

Same as with Number: you must check if the argument is a String or not, 
otherwise it's not a "Safe" comparison.
Btw, I wonder if these methods should really be in Collections.


Levente


More information about the Squeak-dev mailing list