Thread overview | |||||
---|---|---|---|---|---|
|
October 06, 2010 [Issue 5002] New: possible std.stream improvements | ||||
---|---|---|---|---|
| ||||
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 --- Comment #0 from Daniel Gibson <metalcaedes@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: ------- |
October 07, 2010 [Issue 5002] possible std.stream improvements | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Gibson | http://d.puremagic.com/issues/show_bug.cgi?id=5002 nfxjfg@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nfxjfg@gmail.com --- Comment #1 from nfxjfg@gmail.com 2010-10-06 20:54:14 PDT --- 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: ------- |
October 11, 2010 [Issue 5002] possible std.stream improvements | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Gibson | http://d.puremagic.com/issues/show_bug.cgi?id=5002 --- Comment #2 from Daniel Gibson <metalcaedes@gmail.com> 2010-10-11 13:20:40 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: ------- |
Copyright © 1999-2021 by the D Language Foundation