PositionableStream>>uint32 etc...??

Daniel Vainsencher danielv at netvision.net.il
Wed Jul 9 16:07:53 UTC 2003


I'd like to add another criterion to the below - some way or other, it
would be better if this kind of format needs to be specified in only one
place. Note that most of the below options require replicating this
information at least between the read and the write methods. The only
one below that doesn't is the "different classes" version. But if a
class for each type are a bit heavy weight for your need, it might still
be interesting to create some way of abstracting this specification...

An example of this issue is in Celeste, where some fields are integers
and some are strings, when saving the categories file, and maybe in the
other files.

Daniel

> >     fillPacketWithHeader: header type: type nField: nField
> >         aStream int8: header.
> >         aStream uint16: type.
> >         aStream uint32: nField.

vs -

> >     fillPacketWithHeader: header type: type nField: nField
> >         header writeInt8On: aStream.
> >         type writeUint16On: aStream.
> >         nField writeUint32On: aStream.

vs

> The second could also be written as:
> 
>       fillPacketWithHeader: header type: type nField: nField
>           header writeOn: aStream.
>           type   writeOn: aStream.
>           nField writeOn: aStream.

With more classes

vs

>       fillPacketWithHeader: header type: type nField: nField
>           header asInt8    writeOn: aStream.
>           type   asUInt16  writeOn: aStream.
>           nField asUInt32  writeOn: aStream.



More information about the Squeak-dev mailing list