www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - stream.d - Annoying Missing Types

reply Trevor Parscal <Trevor_member pathlink.com> writes:
I have said it before, but obviously it got lost in the mountain of "WALTER,
PLEASE DO THIS! I SWEAR IT'S IMPORTANT" requests...

Every time I update my DMD compiler, I have to add these 2 lines..


void read(out byte x) { readExact(&x, x.sizeof); fixBO(&x,x.sizeof); }
void read(out ubyte x) { readExact(&x, x.sizeof); fixBO(&x,x.sizeof); }

at line 2318 of src/phobos/std/stream.d

Some people say, "But it's an endian stream, so byte order doesn't affect
reading one byte." But how annoying is it when you need an endian stream to read
some bytes, some ints, and some longs ? VERY because these lines aren't in
there.

So for the sake of making it easier to use the stream class, even though it's
quite obvious why these lines weren't in there to begin with, I recomend they
are added to the distributed release of phobos.

Thanks for reading my ranting - I'm off to add the lines manually to the latest
release.. AGAIN.

Thanks,
Trevor Parscal
Jun 30 2006
parent Ben Hinkle <Ben_member pathlink.com> writes:
In article <e8526t$2ai1$1 digitaldaemon.com>, Trevor Parscal says...
I have said it before, but obviously it got lost in the mountain of "WALTER,
PLEASE DO THIS! I SWEAR IT'S IMPORTANT" requests...

Every time I update my DMD compiler, I have to add these 2 lines..


void read(out byte x) { readExact(&x, x.sizeof); fixBO(&x,x.sizeof); }
void read(out ubyte x) { readExact(&x, x.sizeof); fixBO(&x,x.sizeof); }

at line 2318 of src/phobos/std/stream.d

Some people say, "But it's an endian stream, so byte order doesn't affect
reading one byte." But how annoying is it when you need an endian stream to read
some bytes, some ints, and some longs ? VERY because these lines aren't in
there.

So for the sake of making it easier to use the stream class, even though it's
quite obvious why these lines weren't in there to begin with, I recomend they
are added to the distributed release of phobos.

Thanks for reading my ranting - I'm off to add the lines manually to the latest
release.. AGAIN.

Thanks,
Trevor Parscal

I remember the earlier post about this. I think I replied at the time that those methods are inherited. It now occurrs to me that due to D's overloading rules EndianStream should have an "alias Stream.read read;" (if I remember my syntax correctly) in order to allow overloading to work in the case when you have a declared EndianStream that you are manipulating. Is this the case you are in? If so you can declare the variable as a Stream instead of an EndianStream and overloading will work fine. On a separate note you can always submit changes to Walter and see if he responds. -Ben
Jul 03 2006