[squeak-dev] news from the Xtream front

Levente Uzonyi leves at elte.hu
Tue Dec 8 14:12:16 UTC 2009


On Tue, 8 Dec 2009, Nicolas Cellier wrote:

>
> Oh yes, like this ?
>
> | file |
> [file := MultiByteFileStream newFileNamed: 'mbfs_skip.tst'.
> file ascii; wantsLineEndConversion: false; converter: UTF8TextConverter new.
> file nextPutAll: 'Ceci doit changé'.
> file skip: -1. "Oops - grammatically incorrect"
> file nextPutAll: 'er'.
> file close.
>
> file := StandardFileStream oldFileNamed: 'mbfs_skip.tst'.
> file ascii.
> file contentsOfEntireFile.]
> 	ensure: [file close.
> 		FileDirectory default deleteFileNamed: 'mbfs_skip.tst'].
> -> 'Ceci doit chang?er' "Oops squeakly incorrect"
>
> Ah Ah, MultiByteFileStream let us see a stream of encoded characters,
> but position over a stream of bytes...
> The only programmer choice is to put marks (by inquiring aMBFS
> position) and restore position using these marks...
>

Well, this part is broken, but the current fileIn/fileOut code relies on 
this bug/"feature", otherwise it would be easy to fix it in the utf8 case.
Actually I was thinking about CompiledMethod >> #getPreambleFrom:at: or 
even worse PositionableStream >> #backChunk.

> Making something simple out of current MultiByteFileStream mess is a
> challenge I don't even want to take, but you seem a but tougher than
> me.
>

I think the current performance of MultiByteFileStream is acceptable for 
general use. According to my measurements the greatest bottleneck is 
WriteStream >> #nextPut: for typical operations.


Levente

> Cheers
>
> Nicolas
>
>>
>> Levente
>>
>>> Cheers
>>>
>>> Nicolas
>>>
>>>
>>
>>
>
>


More information about the Squeak-dev mailing list