[squeak-dev] The Inbox: Monticello-nice.545.mcz

Levente Uzonyi leves at elte.hu
Thu May 23 23:04:55 UTC 2013


On Thu, 23 May 2013, commits at source.squeak.org wrote:

> Nicolas Cellier uploaded a new version of Monticello to project The Inbox:
> http://source.squeak.org/inbox/Monticello-nice.545.mcz
>
> Item was changed:
>  ----- Method: MCMczWriter>>serializeDefinitions: (in category 'serializing') -----
>  serializeDefinitions: aCollection
>  	| writer s |
> + 	s := String new writeStream.
> - 	s := RWBinaryOrTextStream on: String new.
>  	writer := self snapshotWriterClass on: s.
>  	writer writeDefinitions: aCollection.
>  	^ s contents!

More nitpicking:
Using "String new writeStream" is inefficient compared to "String 
streamContents: []". It also requires the use of local variables and an 
extra message send. How about this?

serializeDefinitions: aCollection

 	^String streamContents: [ :stream |
 		(self snapshotWriterClass on: stream)
 			writeDefinitions: aCollection ]

>
> Item was changed:
>  ----- Method: MCStReader>>readStream (in category 'evaluating') -----
>  readStream
> + 	| contents |
> + 	contents := stream contents.
>  	^ ('!!!!
>
> + ', ([contents utf8ToSqueak] on: InvalidUTF8 do: [:exc | exc return: contents])) readStream!
> - ', stream contents) readStream!
>
> Item was changed:
>  ----- Method: MCStWriter>>writeDefinitions: (in category 'writing') -----
>  writeDefinitions: aCollection
>  	"initStream is an ugly hack until we have proper init defs"
>  	initStream := String new writeStream.
>
>  	(MCDependencySorter sortItems: aCollection)
>  		do: [:ea | ea accept: self]
>  		displayingProgress: 'Writing definitions...'.
>
> + 	stream nextPutAll: initStream contents squeakToUtf8.!
> - 	stream nextPutAll: initStream contents.!
>
>
>


More information about the Squeak-dev mailing list