On Thu, 23 May 2013, commits@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.!
Ah yes, that's right, it's because I made the minimal change to the method. This is an un-necessary change anyway, but those RWBinaryOrTextStream are one of the things that most annoys me ;)
2013/5/24 Levente Uzonyi leves@elte.hu
On Thu, 23 May 2013, commits@source.squeak.org wrote:
Nicolas Cellier uploaded a new version of Monticello to project The Inbox:
http://source.squeak.org/**inbox/Monticello-nice.545.mczhttp://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.!
squeak-dev@lists.squeakfoundation.org