annotation
@Writes
@Writes(Property)
@Writes(Property) declares that a handler writes the named property. Like @Reads it is an analysis hint that documents a handler's data footprint so tooling and scheduling can reason about conflicts — two handlers that write the same property, or one that writes what another reads, cannot be reordered freely. It does not bind fields or grant access on its own; the handler still queries and mutates the property in its body as usual. Declaring reads and writes together makes a handler's effect on the world legible at a glance, which matters most in a large, modular codebase. Keep the named property accurate so the declared footprint matches the code.
Example
program WriteFootprint {
property Health { current: int = 100 }
model Enemy { Health }
@Reads(Health) @Writes(Health) # full read/write footprint
handler ApplyPoison phase Update {
for (Health) in query [Health, {Enemy}] {
Health.current = Health.current - 1
}
}
handler SpawnEnemy phase Start {
spawn Enemy { Health { current: 100 } }
}
}