stream.d - Annoying Missing Types

Ben Hinkle Ben_member at pathlink.com
Mon Jul 3 05:59:53 PDT 2006


In article <e8526t$2ai1$1 at 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





More information about the Digitalmars-d mailing list