On Tue, 2013-05-28 at 13:46 -0400, Jonathan M Davis wrote: […] > Do you mean something like std.mmfile.MmFile which operates on a file as an > array in memory using mmap, or do you mean operating on memory that has no > connection to a file at all (in which case, I'm not sure why you'd want to > use > File)? If the former, well use std.file.MmFile. If the latter, I expect that > you're out of luck. Unfortunately, std.stdio.File is currently just a wrapper > around FILE and is thus limited by what you can do with FILE - that and I > don't think that the File API took into consideration the possibility of > operating on anything other than an actual file (and I honestly don't know > what > you'd be trying to do with it where it would make any sense for to operate on > anything other than an actual file).
Looks like I am out of luck then. :-( The context is writing a small program that can be a filter or operate on files: actually it is the wc program. So it needs to work with opened files and stdin. That is fine (sort of). The issue comes when writing unit tests for the code: unit tests should not touch the file system, so I need a memory buffer backed std.stdio.File for the tests. A mock file in a sense.As noted earlier Go, Python, all JVM languages have such things, and it really needs to be part of D. If there really is nothing like this, I should add a JIRA issue and see if I can create a pull request later in the summer. -- Russel. ============================================================================= Dr Russel Winder t: +44 20 7585 2200 voip: sip:[email protected] 41 Buckmaster Road m: +44 7770 465 077 xmpp: [email protected] London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
signature.asc
Description: This is a digitally signed message part
