Why does `filterBidirectional` exist, and why isn't it called `filter`?

Paul Backus snarwin at gmail.com
Thu Mar 9 21:16:27 UTC 2023


On Thursday, 9 March 2023 at 19:48:21 UTC, Steven Schveighoffer 
wrote:
> On 3/9/23 12:07 PM, Paul Backus wrote:
>> I think probably you have to go on a case-by-case basis. 
>> `File.byLine`, for example, does not and should not precompute 
>> `front`, because doing so is potentially very expensive. OTOH, 
>> `iota` does and should precompute `front`, because doing so is 
>> essentially free and makes the implementation much simpler.
>
> I disagree. If you construct a `byLine` you intend to iterate 
> by lines.

I gave examples in my post of situations where the user may 
construct a range before deciding whether or not to iterate it. 
If you find those examples unconvincing, I'd be happy to hear why.


More information about the Digitalmars-d mailing list