Skip to content

Multi-properties should be indexed by default. #672

Description

@RobertJacobsonCDC

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().

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions