A Small Contribution to Phobos

Jonathan M Davis jmdavisProg at gmx.com
Sun Jun 16 19:03:37 PDT 2013


On Monday, June 17, 2013 03:41:45 irritate wrote:
> I think they both have their advantages, which is why it's
> probably important to be able to control the behavior regardless
> of which one is default.  I choose pipeOnPop as the default
> because:
> 
> 1)  It more closely tied in to the idea of tapping into the data
> as the wrapped range is iterated over (i.e. calling front
> multiple times won't call the function multiple times, as you
> said).
> 2)  I felt like I would personally use pipeOnPop more often, and
> figured the most commonly used case should not require the flag.
> 
> But I'm not especially tied to it, and could see making
> pipeOnFront default if that is preferred.
> 
> And actually, as I think about what I just wrote and also my
> previous unittest example, it almost feels like pipeOnPop gives
> you insight into the wrapped range itself, and pipeOnFront gives
> you more insight into how the range is used.  The incoming vs.
> the outgoing, as it were.  And I imagine I'd like to know more
> about what is coming in more of the time, but that's just my
> opinion.

I would think that pipeOnPop would be better by default simply because it's 
the more efficient thing to do, especially if it's not clear which the 
programmer is more likely to want in the general case.

- Jonathan M Davis


More information about the Digitalmars-d mailing list