Why does `filterBidirectional` exist, and why isn't it called `filter`?
Atila Neves
atila.neves at gmail.com
Fri Apr 14 11:10:54 UTC 2023
On Thursday, 9 March 2023 at 08:06:02 UTC, FeepingCreature wrote:
> Yes I know the stated reason, to save time initializing the
> range in `filter`.
>
> You know what I did because we didn't know
> `filterBidirectional` existed?
>
> I literally *walked the entire range* returned by `filter` to
> find the last matching element.
>
> `filter` should expose `back`. By all means, let `back` lazily
> initialize, but I don't understand how `filterBidirectional`
> was ever considered acceptable. Since when do we sacrifice ease
> of use for performance? I mean, since 2011 apparently. - This
> is bad ergonomics, bad discoverability and bad API design.
> `filterBidirectional` delenda est.
I agree with the sentiment here, but I do wonder about unintended
consequences of pre-computing `back` as well as `front`.
Atila
More information about the Digitalmars-d
mailing list