Re: iopipe: Writing output to std.io File

2020-01-26 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 27 January 2020 at 01:50:00 UTC, Jesse Phillips wrote: Just as I'm hitting send the part I'm missing clicked: I needed to add the text encoding because my buffer is `char` but File writes `ubyte` ```dlang auto output() { return std.io.File("somefile.txt",

Re: iopipe: Writing output to std.io File

2020-01-26 Thread Jesse Phillips via Digitalmars-d-learn
Just as I'm hitting send the part I'm missing clicked: I needed to add the text encoding because my buffer is `char` but File writes `ubyte` ```dlang /+ dub.sdl: name "iobuftofile" dependency "iopipe" version="~>0.1.7" dependency "io" version="~>0.2.4" +/ void main() { import

iopipe: Writing output to std.io File

2020-01-26 Thread Jesse Phillips via Digitalmars-d-learn
I'd like to start utilizing IOPipe[1] more. Right now I have an interest in utilizing it for buffering output (actually I don't have a need for buffering, I just want to utilize iopipe) Looking through some different examples[2][3] I thought I would have something with this: ```dlang /+

Why does foreach allow ref element for non-ref front() of std.range.enumerate()

2020-01-26 Thread Boris-Barboris via Digitalmars-d-learn
import std; import std.range; void main() { int[] a = [3, 5, 7]; foreach (i, ref ae; a.enumerate) { writeln(i, " ", ae); ae = 6; } writeln(a); assert(a[].equal([6, 6, 6])); // fails, a is in initial state } Why does the compiler allow such 'ref ae' loop,