[squeak-dev] The Trunk: System-bf.411.mcz

Bert Freudenberg bert at freudenbergs.de
Tue Jan 11 14:56:56 UTC 2011


On 11.01.2011, at 15:46, Levente Uzonyi wrote:

> On Tue, 11 Jan 2011, commits at source.squeak.org wrote:
> 
>> Bert Freudenberg uploaded a new version of System to project The Trunk:
>> http://source.squeak.org/trunk/System-bf.411.mcz
>> 
>> ==================== Summary ====================
>> 
>> Name: System-bf.411
>> Author: bf
>> Time: 11 January 2011, 3:08:35.095 pm
>> UUID: 64b24272-ea53-45f6-878c-d147e8115fe5
>> Ancestors: System-cmm.410
>> 
>> Make SystemDictionary>>classAndTraitNames work if there are no traits (such as after unloadAllKnownPackages).
> 
> Nice find.
> Levente

Hehe. You *could* say the method is too cleverly optimized ;)

- Bert -

>> 
>> =============== Diff against System-cmm.410 ===============
>> 
>> Item was changed:
>> ----- Method: SystemDictionary>>classAndTraitNames (in category 'classes and traits') -----
>> classAndTraitNames
>> 	"Answer a sorted collection of all class and trait (not including class-traits) names. The performance of this algorithm is O(n) if the classNames are already cached, otherwise O(n*log(n)) where n is self size."
>> 
>> 	| classNames traitNames result temporary |
>> 	classNames := self classNames.
>> 	traitNames := self traitNames.
>> + 	traitNames ifEmpty: [^classNames].
>> 	temporary := Array new: classNames size + traitNames size.
>> 	result := temporary shallowCopy.
>> 	temporary
>> 		replaceFrom: 1
>> 		to: classNames size
>> 		with: classNames
>> 		startingAt: 1;
>> 		replaceFrom: classNames size + 1
>> 		to: temporary size
>> 		with: traitNames
>> 		startingAt: 1;
>> 		mergeFirst: 1
>> 		middle: classNames size
>> 		last: temporary size
>> 		into: result
>> 		by: nil.
>> 	^result!
>> 
>> 
>> 
> 





More information about the Squeak-dev mailing list