outfox / fennecs

... the tiny C# ECS that loves you back!
https://fennecs.tech
MIT License
223 stars 10 forks source link

Stream<>.Truncate doesn't (cannot) respect Filters #20

Closed thygrrr closed 2 months ago

thygrrr commented 2 months ago

What

There's no unambiguous semantic meaning for "truncate" on a filtered stream, unless it's a per-archetype truncation, because the full size of the filtered set can't really be known as it is passed on to the underlying Query.

The user may expect truncation over the filtered set, not the entire query.

How to fix

Either remove the function from (all) Streams, or change the semantics accordingly.

thygrrr commented 2 months ago

Fixed by removing the forwarded call from the decendant's API, use the Stream.Query.Truncate(int) instead. (this was what it was doing all along, but now there is no ambiguity about the Stream's filter state)