Thread overview
Canonical/Idiomatic in memory files
May 28, 2013
Russel Winder
May 28, 2013
Martin Nowak
May 29, 2013
Russel Winder
May 29, 2013
Paulo Pinto
May 29, 2013
Martin Nowak
May 28, 2013
Walter Bright
May 28, 2013
Hi,

I think I am missing something very obvious…

For unit tests I want a std.stdio.File object that is backed by an in memory string buffer rather than an actual file on disc, be it temporary or otherwise.  I think I am missing where this is documented in the documentation. Or is it actually not available?

Thanks.

-- 
Russel. ============================================================================= Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder@ekiga.net 41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel@winder.org.uk London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder


May 28, 2013
On 05/28/2013 05:04 PM, Russel Winder wrote:
> Hi,
>
> I think I am missing something very obvious…
>
> For unit tests I want a std.stdio.File object that is backed by an in
> memory string buffer rather than an actual file on disc, be it temporary
> or otherwise.  I think I am missing where this is documented in the
> documentation. Or is it actually not available?
>
> Thanks.
>
This is only available for std.stream http://dlang.org/phobos/std_stream.html#.MemoryStream.
May 28, 2013
On 5/28/2013 8:04 AM, Russel Winder wrote:
> Hi,
>
> I think I am missing something very obvious…
>
> For unit tests I want a std.stdio.File object that is backed by an in
> memory string buffer rather than an actual file on disc, be it temporary
> or otherwise.  I think I am missing where this is documented in the
> documentation. Or is it actually not available?

Part of the idea of using ranges is you can switch to a memory buffer instead of an actual file.

May 29, 2013
On Tue, 2013-05-28 at 19:51 +0200, Martin Nowak wrote: […]
> This is only available for std.stream http://dlang.org/phobos/std_stream.html#.MemoryStream.

This package has a big red "deprecated" notice, so I didn't look at it. Is this an indication that I should? Is there a planned replacement?
-- 
Russel. ============================================================================= Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder@ekiga.net 41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel@winder.org.uk London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder


May 29, 2013
Am 29.05.2013 06:48, schrieb Russel Winder:
> On Tue, 2013-05-28 at 19:51 +0200, Martin Nowak wrote:
> […]
>> This is only available for std.stream
>> http://dlang.org/phobos/std_stream.html#.MemoryStream.
>
> This package has a big red "deprecated" notice, so I didn't look at it.
> Is this an indication that I should? Is there a planned replacement?
>

Actually I am also making heavy use of it, as I am porting to D a Java
based application that uses streams.

Relying on std.stream makes the porting easier, but I am also wondering about it.

--
Paulo
May 29, 2013
On 05/29/2013 06:48 AM, Russel Winder wrote:
> Is there a planned replacement?
We want to have a range based replacement, but it's nowhere near in sight.