Description
What problem does this solve or what need does it fill?
While the Event
trait is required for both observers and buffered events, it's very uncommon to use a single event type as both an observer and a buffered event.
These are used differently and have distinct semantics, despite both representing .
This makes the API more challenging to understand, opens users up to footguns where they create EventReader
s for observer events or send buffered events via targeting, and also causes false positives for potential linting tools that attempt to check for things like "all Event
types should have a add_event
call".
What solution would you like?
Split the trait, keeping the Event
trait name for buffered events, and Signal
for observer events.
What alternative(s) have you considered?
We could consider unifying the underlying implementations in some way, to allow for users to seamlessly choose between them. That would entail:
- Replicating all observer-events to buffered-events, which discards the information about what entity was targeted.
- Automatically sending all buffered-events to observers, targeting nothing.
I don't think that this is particularly useful or clear, and has a non-trivial performance overhead. Given that I haven't seen users asking for this, and it can be easily manually implemented if it is desired, I don't think this is the right call.
Additional context
I advocated for adding a marker trait for observer events here. Much bikeshedding followed.
The unification was eventually completed by @cart in #10839 (comment), per #10839 (comment).
I think we should try to unify Event and Trigger with the intent to (ultimately) make normal "buffered" events triggerable.
IMO this change didn't get appropriate consideration due to the extreme length and complexity of that PR and should be reverted :)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status