ludic/selfhost
Orkuncakilkaya 6e11212cf2 Lifecycle hooks: @OnStart/@OnQuit, @OnDespawn, @OnAttach (like @OnSpawn)
Adds the rest of the game/entity/property lifecycle as @-hooks, each firing at
one timeline moment and reducing to ordinary code:

- @OnStart / @OnQuit (program): @OnStart aliases the Start phase; @OnQuit runs in
  the frame loop's done: block, after the loop stops and before teardown.
- @OnDespawn(Model) (entity): a destructor. Despawn doesn't statically know the
  entity's model, so hooks compile to @on_despawn_<Model>(entity) functions and
  emit_despawn dispatches on @L_kind. Symmetric with @OnSpawn.
- @OnAttach(Property): fires in emit_init_component once a property is attached
  and seeded, with the property bound by name.

Registries + parsing mirror @OnSpawn. examples/lifecycle.ludic narrates the whole
timeline (output 1 700 50 950 2). Behaviour-preserving (goldens byte-identical,
despawn users unaffected when no hooks registered); test.sh 16/16, fixpoint holds.

Deferred: @OnDetach (per-property runtime dispatch) and scene @OnEnter/@OnExit
(need scene support in the compiler).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-27 21:15:50 +03:00
..
golden Baseline: Ludic compiler + toolchain, Phase 1 syntax fixes complete 2026-08-27 15:15:35 +03:00
tests Phase 6a: rename core vocabulary (game/main/component/archetype/system) 2026-08-27 18:22:13 +03:00
ast.ludic Phase 4b: enum types name magic-int value spaces 2026-08-27 16:29:02 +03:00
bootstrap-cfree.sh Phase 6a: rename core vocabulary (game/main/component/archetype/system) 2026-08-27 18:22:13 +03:00
bootstrap.sh Baseline: Ludic compiler + toolchain, Phase 1 syntax fixes complete 2026-08-27 15:15:35 +03:00
buf.ludic Phase 2: enforce statement separators (Rule B) 2026-08-27 15:41:29 +03:00
build.sh Phase 6a: rename core vocabulary (game/main/component/archetype/system) 2026-08-27 18:22:13 +03:00
compile.sh Baseline: Ludic compiler + toolchain, Phase 1 syntax fixes complete 2026-08-27 15:15:35 +03:00
emit_addr.ludic Phase 2: enforce statement separators (Rule B) 2026-08-27 15:41:29 +03:00
emit_core.ludic Lifecycle hooks: @OnStart/@OnQuit, @OnDespawn, @OnAttach (like @OnSpawn) 2026-08-27 21:15:50 +03:00
emit_decl.ludic Phase 2: enforce statement separators (Rule B) 2026-08-27 15:41:29 +03:00
emit_ecs.ludic Phase 2: enforce statement separators (Rule B) 2026-08-27 15:41:29 +03:00
emit_expr.ludic Scriptable properties (ECS-safe subset): @Computed and @OnSpawn 2026-08-27 21:01:32 +03:00
emit_game.ludic Lifecycle hooks: @OnStart/@OnQuit, @OnDespawn, @OnAttach (like @OnSpawn) 2026-08-27 21:15:50 +03:00
emit_head.ludic Phase 2: enforce statement separators (Rule B) 2026-08-27 15:41:29 +03:00
emit_intrin.ludic Phase 2: enforce statement separators (Rule B) 2026-08-27 15:41:29 +03:00
emit_intrin2.ludic Phase 2: enforce statement separators (Rule B) 2026-08-27 15:41:29 +03:00
emit_machine.ludic Phase 2: enforce statement separators (Rule B) 2026-08-27 15:41:29 +03:00
emit_math.ludic Phase 2: enforce statement separators (Rule B) 2026-08-27 15:41:29 +03:00
emit_new.ludic Phase 2: enforce statement separators (Rule B) 2026-08-27 15:41:29 +03:00
emit_query.ludic Phase 2: enforce statement separators (Rule B) 2026-08-27 15:41:29 +03:00
emit_save.ludic Phase 2: enforce statement separators (Rule B) 2026-08-27 15:41:29 +03:00
emit_spawn.ludic Lifecycle hooks: @OnStart/@OnQuit, @OnDespawn, @OnAttach (like @OnSpawn) 2026-08-27 21:15:50 +03:00
emit_stmt.ludic Phase 2: enforce statement separators (Rule B) 2026-08-27 15:41:29 +03:00
emit_ui.ludic Phase 2: enforce statement separators (Rule B) 2026-08-27 15:41:29 +03:00
game-build.sh Baseline: Ludic compiler + toolchain, Phase 1 syntax fixes complete 2026-08-27 15:15:35 +03:00
io.ludic Baseline: Ludic compiler + toolchain, Phase 1 syntax fixes complete 2026-08-27 15:15:35 +03:00
lex.ludic Phase 2: enforce statement separators (Rule B) 2026-08-27 15:41:29 +03:00
ludicc.seed.ll Lifecycle hooks: @OnStart/@OnQuit, @OnDespawn, @OnAttach (like @OnSpawn) 2026-08-27 21:15:50 +03:00
main.ludic Phase 6a: rename core vocabulary (game/main/component/archetype/system) 2026-08-27 18:22:13 +03:00
parse.ludic Lifecycle hooks: @OnStart/@OnQuit, @OnDespawn, @OnAttach (like @OnSpawn) 2026-08-27 21:15:50 +03:00
parse_game.ludic Scriptable properties (ECS-safe subset): @Computed and @OnSpawn 2026-08-27 21:01:32 +03:00
reseed.sh Phase 6a: rename core vocabulary (game/main/component/archetype/system) 2026-08-27 18:22:13 +03:00
str.ludic Phase 2: enforce statement separators (Rule B) 2026-08-27 15:41:29 +03:00
test.sh Baseline: Ludic compiler + toolchain, Phase 1 syntax fixes complete 2026-08-27 15:15:35 +03:00