[Pharo-project] Xtreams vs become:

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Sat Oct 16 03:58:32 EDT 2010


2010/10/15  <mkobetic at gmail.com>:
> "Nicolas Cellier"<nicolas.cellier.aka.nice at gmail.com> wrote:
>> I've tested this strategy, and it works well:
>>
>> - use accessors self input/self output instead of inst. var.
>> - lazily initialize the input for Collection and File
>
> Sounds good to me, less work too. I just thought the write:read: approach makes it clearer that you need to do all the writing first and then all the reading. But that'll probably become clear quite quickly. So I think I'll go with your approach. The only case I wonder about is the one where we loop with progressively larger buffer sizes, so we'll need to be able to rebuild the input and output several times. I'll see if I can figure something out.
>

The tests interleaving read/write are
#testWriteFromCollectionAt
#testWriteFromStream
#testWriteTransformHexToByte
#testReadWriteLargeAmount

Then #testGetPastEnd also relies on become: on close... If we change
the grown policy:
    destination := destination grownBy: (destination size max: 10)
instead of:
    destination := destination grownBy: (destination size max: 1)
then the test does not pass.

This also is because I used:
    input := outer terminal reading
rather than:
    input := outer conclusion reading

>> In collection tests, I have used
>>       ^input ifNil:[input := outer terminal reading]
>> where: outer := output := collection writing.
>> This is because some Block transforms can't access the terminal collection...
>
> Not sure what you mean, but it will probably get clearer when I go do it.
>

BlockWriteStream terminal answers a block... But yes, it will be
clearer when debugging it.

> BTW, I've updated the package comments and regenerated the docs on the site yesterday. If you want to see the changes highlighted, go through the Sources tab and switch to the wiki repository. The diff view is quite usable there.
>
> Martin
>

Nice. Squeak lack package comment.... :(

Nicolas




More information about the Pharo-dev mailing list