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

FeepingCreature feepingcreature at gmail.com
Thu Mar 9 08:06:02 UTC 2023


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.


More information about the Digitalmars-d mailing list