[Issue 5002] New: possible std.stream improvements

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 6 09:22:03 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=5002

           Summary: possible std.stream improvements
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: metalcaedes at gmail.com


--- Comment #0 from Daniel Gibson <metalcaedes at gmail.com> 2010-10-06 09:21:40 PDT ---
I've got a few suggestions to make std.stream more convenient (and in one case
just the documentation more clear). See my NG post [1] for details, I'll just
summarize it here:

* The documentation claims write( <basic type> ) is implementation specific -
this is not true for most types - it's actually platform specific and with the
EndianStream most read/write operations can safely be used between different
platforms. Especially for the SocketStream this is good to know.

* InputStream's read( <type> val ) sometimes is inconvenient, please add
something like
T read(T)() { T ret; readExact(&ret, ret.sizeof); return ret; }
So one can use "myFun( s.read!float );" instead of "float x; s.read(x);
myFun(x);"

* Minor inconsistencies: add readExact(ubyte[] buf) to Inputstream, because
there is a read(ubyte[] buf) and add writeExact(ubyte[] buf) to OutputStream
because there is write(ubyte[] buf).

* For convenience ubyte[] readExact(size_t len) might be nice.

Thanks,
- Daniel

[1]
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=118413
- my NG post on these matters (and also on bug 5001)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list