Nicolas Cellier uploaded a new version of Monticello to project The Inbox:
http://source.squeak.org/inbox/Monticello-nice.545.mcz ==================== Summary ==================== Name: Monticello-nice.545 Author: nice Time: 23 May 2013, 11:00:14.509 pm UUID: 83c3e004-45ee-4976-b80e-de52f74691c5 Ancestors: Monticello-fbs.544 Let MC encode source in UTF-8 STEP 2: let MCStWriter encode and MCStReader decode. Note 1: no BOM is used in this version, and legacy code is handled in InvalidUTF8 exception handling. Note 2: MCStReader is not used. =============== Diff against Monticello-fbs.544 =============== 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! 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.! |
On Thu, 23 May 2013, [hidden email] 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 <[hidden email]>
|
Free forum by Nabble | Edit this page |