digitalmars.D.bugs - [Issue 5002] New: possible std.stream improvements
- d-bugmail puremagic.com (37/37) Oct 06 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5002
- d-bugmail puremagic.com (11/11) Oct 06 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5002
- d-bugmail puremagic.com (15/15) Oct 11 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5002
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 puremagic.com ReportedBy: metalcaedes gmail.com 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: -------
Oct 06 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5002 nfxjfg gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nfxjfg gmail.com I thought std.stream is deprecated. Maybe "someone" could confirm and close this as invalid. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 06 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5002 PDT --- It will probably be deprecated, but at this time it isn't (there is no alternative yet, anyway). However I just realized that my idea for read() can't be implemented *that* easy because it wouldn't work properly with EndianStream. For that to work one would have to check whether T is a simple type (int, float, double, long, etc) and in that case call fixBO() in EndianStream (like the available, inconvenient read(<basic type>) methods in EndianStream already do). Or do it old school and provide readInt(), readUInt(), readLong(), readUlong(), readFloat() etc instead of using a template. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 11 2010