You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For context, we most use a BoundQuery wrapper over QueryDescription, that adds a few features:
A World is bound to each query
The world is locked on unlocked for each query, to avoid structural change during the query
All query types are checked on construction to see if they belong to that world (some types are available on multiple worlds, but it has to be defined)
By default, None<Destroyed> is added to the query
Utility methods are mirrored from QueryDescription, such as Count, Destroy Add and Remove
This is extremely useful. It even works as a higher order definition. For example our UI widgets simply define the query that will spawn them automatically.
However, it also has issues. Since our query api uses lambdas for flexibility, avoiding allocations is difficult. We also lose on some performance compared to the source generator.
I've attempted to mirror these features using the source generator, it's however been difficult. Adding default flags is impossible, and we have to specify and lock/unlock the world every time.
attributes are read by reading constructor parameters, so it's impossible to create an attribute with a "default" or hardcoded query params
only the first attribute that matches the name pattern is used, so "NotDestroyedAttribute" could not be composited with "NotAttribute"
I also wanted to be able to bind a world to a query, or to just add a wrapper around the query to lock the world, but neither seemed possible.
We end up with boilerplate around each generated queries:
For context, we most use a
BoundQuery
wrapper over QueryDescription, that adds a few features:None<Destroyed>
is added to the queryThis is extremely useful. It even works as a higher order definition. For example our UI widgets simply define the query that will spawn them automatically.
However, it also has issues. Since our query api uses lambdas for flexibility, avoiding allocations is difficult. We also lose on some performance compared to the source generator.
Here's an simple example:
I've attempted to mirror these features using the source generator, it's however been difficult. Adding default flags is impossible, and we have to specify and lock/unlock the world every time.
attributes are read by reading constructor parameters, so it's impossible to create an attribute with a "default" or hardcoded query params
only the first attribute that matches the name pattern is used, so "NotDestroyedAttribute" could not be composited with "NotAttribute"
I also wanted to be able to bind a world to a query, or to just add a wrapper around the query to lock the world, but neither seemed possible.
We end up with boilerplate around each generated queries:
Ideally, this would look more like
This could be done by:
The text was updated successfully, but these errors were encountered: