On 11/17/16 10:38 AM, John Colvin wrote:
On Thursday, 17 November 2016 at 13:59:25 UTC, Steven Schveighoffer wrote:
nullStream!char
.bufferedInput
.pushTo(
arrayCastPipe!ubyte
.outputFile("output.txt")
);
But then the parameters to the "pushTo" hypothetical function don't
know what the source type is before calling. By inserting valves, I
get the equivalent thing, but the types all are passed down the chain
properly.
Can't you use a template lambda alias argument to pushTo instead, so
then you can instantiate it inside pushTo?
something like
nullStream!char
.bufferedInput
.pushTo!(_ => _
.arrayCastPipe!ubyte
.outputFile("output.txt")
);
maybe?
I could do that. But I don't like it ;)
I will note that Adrian Matoga's flod library has a different solution
that I think is similar to this, but I don't understand it very well.
I'm also concerned that using a lambda is going to confuse or prevent
optimization.
I think with some better naming, the push feature will look better.
-Steve