Currently the only use-cases of multi-properties is
- to index several properties jointly. (Also, to count combinations of different values, which is an index function.)
- to subscribe to property change events for a set of properties as if it were a single property.
Thus, it probably makes sense to make them indexed automatically.
Right now, you can define a multi-property:
define_multi_property!((Name, Age, Weight), Person);
And then, separately, you set the multi-property as indexed in a specific Context instance:
context.index_property::<Person, (Name, Age, Weight)>();
Why make the user do this?
It's not clear how to implement this. Right now we have no mechanism for a property to know if it's a multi-property, or more generally if it should be indexed by default. If we built this into the type somehow (e.g. fn Property<E>::default_indexed() -> bool), we could do a check in the PropertyValueStoreCore<E: Entity, P: Property<E>>. Alternatively, we could have a mechanism for creating different constructors for PropertyValueStoreCore<E: Entity, P: Property<E>>, one that indexes and another that doesn't. Entities Design Notes favors a method Property<E>::index_by_default().
Currently the only use-cases of multi-properties is
Thus, it probably makes sense to make them indexed automatically.
Right now, you can define a multi-property:
And then, separately, you set the multi-property as indexed in a specific
Contextinstance:Why make the user do this?
It's not clear how to implement this. Right now we have no mechanism for a property to know if it's a multi-property, or more generally if it should be indexed by default. If we built this into the type somehow (e.g.
fn Property<E>::default_indexed() -> bool), we could do a check in thePropertyValueStoreCore<E: Entity, P: Property<E>>. Alternatively, we could have a mechanism for creating different constructors forPropertyValueStoreCore<E: Entity, P: Property<E>>, one that indexes and another that doesn't. Entities Design Notes favors a methodProperty<E>::index_by_default().