[squeak-dev] The Inbox: Tools-tpr.1003.mcz

Levente Uzonyi leves at caesar.elte.hu
Mon Oct 19 16:39:50 UTC 2020


Hi Tim,

On Mon, 19 Oct 2020, commits at source.squeak.org wrote:

> Item was changed:
>  ----- Method: MessageSet>>initializeMessageList: (in category 'private') -----
>  initializeMessageList: anArray
>  	"Initialize my messageList from the given list of MethodReference or string objects.  NB: special handling for uniclasses.
>  	 Do /not/ replace the elements of anArray if they are already MethodReferences, so as to allow users to construct richer systems, such as differencers between existing and edited versions of code."
> + 	messageList := Set new.
> - 	messageList := OrderedCollection new.
>  	anArray do:
>  		[:each | each isMethodReference
> + 			ifTrue: [messageList add: each]
> - 			ifTrue: [messageList addLast: each]
>  			ifFalse:
>  				[ MessageSet
>  					parse: each
>  					toClassAndSelector:
> + 						[ : class : sel | class ifNotNil: [ messageList add: (MethodReference class: class selector: sel) ] ] ] ].
> + 	messageList := messageList asSortedCollection asOrderedCollection. "Possibly better to do asOrderedCollection sort ?"

Yes, it's better not to use SortedCollection in this case (as in most 
cases).
If messageList does not have to be an OrderedCollection, then

 	messageList := messageList sorted.

is the best option.


Levente


More information about the Squeak-dev mailing list