[squeak-dev] The Inbox: Monticello-cmm.696.mcz

Levente Uzonyi leves at caesar.elte.hu
Mon Apr 22 02:26:37 UTC 2019


On Tue, 16 Apr 2019, commits at source.squeak.org wrote:

> Chris Muller uploaded a new version of Monticello to project The Inbox:
> http://source.squeak.org/inbox/Monticello-cmm.696.mcz

snip

>
> =============== Diff against Monticello-nice.695 ===============
>
> Item was changed:
>  ----- Method: Class>>packageInfo (in category '*monticello') -----
>  packageInfo
> + 	^ ((PackageInfo allPackages select: [ : each | each includesClass: self ])
> + 		ifEmpty: [ nil ]
> + 		ifNotEmpty:
> + 			[ : myPackages | "Select the most-qualified match."
> + 			myPackages sort:
> + 				[ : each | each packageName size ] descending ]) first!

Haven't tried this one, but when there are no matching packages, #first 
with nil receiver will raise DNU.
If you only need the largest value of a collection, then don't sort the 
collection and pick the first but use #detectMax: instead.

> - 	^ PackageInfo allPackages
> - 		detect: [ : each | each includesClass: self ]
> - 		ifNone: [ nil ]!
>

Levente


More information about the Squeak-dev mailing list