ecs/sized-refined
src/ecs/sized-refined.tur
opt-in strict-aliveness accessors for the REAL
Since: RE1 promotion 2026-07-26
defn
ent-at
(ent-at [i : int] :)
the first-generation entity candidate for slot i.
Parameters
| i | slot index (the iteration counter) |
Returns
The Entity (slot i, generation 0).
Example
(GameWorld-alive? w (ent-at 0))
Since: RE1 promotion 2026-07-26
defmacro
sized-defworld-refined
(sized-defworld-refined [world-name])
emit the per-world refined surface anchors:
Parameters
| world-name | the monomorphic sized world type (from sized-defworld-mono) |
Example
(sized-defworld-refined GameWorld) ;; GameWorld-alive? : ^borrow GameWorld Entity -> bool (#reads w) ;; GameWorld-despawn! : ^unique ^mut GameWorld Entity -> bool
Since: RE1 promotion 2026-07-26
defmacro
sized-defcomponent-accessor-refined
(sized-defcomponent-accessor-refined [world-name comp-name])
emit `get-<Comp>!`, the
Parameters
| world-name | the monomorphic sized world type | |
| comp-name | the component (a `(SizedDense n Comp)` field on the world) |
Example
(sized-defcomponent-accessor-refined GameWorld Pos)
;; get-Pos! : ^borrow (ReadCap Pos) ^borrow GameWorld
;; #refine{ x : Entity | (GameWorld-alive? w x) } -> Pos
Since: RE1 promotion 2026-07-26
defmacro
for-each-alive
(for-each-alive [world-name w n binder & body])
run body for each still-alive first-generation entity
Parameters
| world-name | the world TYPE (names the per-world alive? measure) | |
| w | the owned `^mut` world local (borrowed per iteration) | |
| n | slot count to scan (slots 0..n-1) | |
| binder | name bound to the proven-alive Entity for the body | |
| body | forms run per alive entity (result discarded; yields 0) |
Example
(for-each-alive GameWorld w 3 e
(println (:: (get-Pos! rcap w e) :int)))
Since: RE1 promotion 2026-07-26