A Small Contribution to Phobos

monarch_dodra monarchdodra at gmail.com
Sun Jun 16 10:37:31 PDT 2013


On Sunday, 16 June 2013 at 13:39:35 UTC, irritate wrote:
>
> [SNIP]
>
> One concept with this is that the user can pass a flag to 
> specify whether the function should be called on popFront 
> (default) or on front.
>
> [SNIP]
>
> Thanks,
> irritate

What made you change the parameter of :
* "pipeOnPop = false" (eg call on front by default)
to
* "pipeOnFront = false" (eg call on pop by default)
?

I think pipe on front makes more sense, since you'll actually 
*see* the last value that was passed if the stream is terminated, 
eg:
[1, 2, 3, 4].tee!`writeln("processing: ", a).until!"a > 2"();

Which will output:
processing: 1
processing: 2
<end>
what about 3?

Or

processing something A...
processing something B...
core dump...
(stream was actually processing C, but we are fooled into 
investigating B...)

The *advantage* of pipeOnPop is that each element is piped at 
least once, and at most once, so that's good. However, it comes 
with pitfalls which (IMO) I think should be an explicit opt-in.


More information about the Digitalmars-d mailing list