Boston D Language Meetup in Back Bay

Steven Schveighoffer via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Thu Nov 17 05:59:25 PST 2016


On 11/17/16 7:32 AM, qznc wrote:
> On Thursday, 17 November 2016 at 02:55:46 UTC, Meta wrote:
>> Thanks for recording the presentation, your IOPipe library is pretty
>> interesting.
>
> +1
>
> Especially for any parser, this looks like a great solution!

Thanks! I agree, I hope to prove that with some example implementations.

> The output (valves) looks meh, though. I hope, you discover something
> more elegant.

Explaining valves is more complex then actually using them. The neat 
thing about them is that I do not have to implement a push mechanism or 
rewrite any existing transform iopipes. And in general, valves don't 
have to really be involved with pushing. They are simply control points 
along the pipeline (but doing output by simulating push via a pull was 
the impetus for valves).

I will note that an obvious different solution (and one that I 
considered) is to encapsulate the entire output pipe into one call, 
something like:

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.

I'm thinking I will rename the holdingValve and holdingLoop functions, 
so that it's more clear that this results in a push mechanism. I'm still 
playing with the naming.

Eventually, the valve concept I think will be more justified when I have 
more building blocks available that can be used any way you wish.

-Steve


More information about the Digitalmars-d-announce mailing list