digitalmars.D.bugs - [Issue 3868] New: It would be nice to have a function which read a file lazily using a range
- d-bugmail puremagic.com (31/31) Mar 01 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3868
- d-bugmail puremagic.com (10/10) Aug 19 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3868
- d-bugmail puremagic.com (22/22) Aug 19 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3868
- d-bugmail puremagic.com (9/9) Jan 09 2011 http://d.puremagic.com/issues/show_bug.cgi?id=3868
http://d.puremagic.com/issues/show_bug.cgi?id=3868 Summary: It would be nice to have a function which read a file lazily using a range Product: D Version: 2.040 Platform: Other OS/Version: Linux Status: NEW Severity: enhancement Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: jmdavisProg gmail.com 23:13:24 PST --- It would be great if there were a function which returned a range to a file, reading it in as you moved through the range. Presumably, it would do some buffering, but it wouldn't be a case of reading in the whole file at a time and hopefully would be more friendly and powerful than reading in a single byte, or int, or whatever like you'd do with read() with streams. It also avoids having to explicitly read in a portion of the file at a time like you'd do with readBlock(). In addition, it would make it possible to use various of the standard algorithms directly on files. It might also be useful to write to a file with a range, but I'm not acquainted well enough with output ranges to know how well it would work, or if it would be as useful as reading with ranges. It would probably be useful though. In any case, I really like the idea of being to read a file with a range. Maybe there's a reason that I'm not aware of which would make it a really bad idea, but I think that it would be a good addition to phobos. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 01 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3868 David Simcha <dsimcha yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dsimcha yahoo.com Shouldn't std.stdio.File.byChunk() do this? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 19 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3868 Andrei Alexandrescu <andrei metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrei metalanguage.com 21:08:24 PDT --- byChunk uses opApply. We need to transform it into a range; using opApply alone severely limits the applicability of byChunk. Here's a nice potential application of byChunk: import std.stdio; void main(string[] a) { enforce(a.length == 3); auto f1 = File(a[1]), f2 = File(a[2]); immutable bufsize = 1024 * 1024; return equal(f1.byChunk(bufsize), f2.byChunk(bufsize)); } One other idea suggested by the above is to implement the algorithm found in diff in std.algorithm. Then we can write a diff program in a dozen line of code, using general components. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 19 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3868 Andrei Alexandrescu <andrei metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED AssignedTo|nobody puremagic.com |andrei metalanguage.com -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 09 2011