def dispatch_pair

bendvy-ecs-core@0.1.0.4 · ordinary_app_execution_recipe.bend:94

import bendvy-ecs-core@0.1.0.4/ordinary_app_execution_recipe.bend as OrdinaryAppExecutionRecipe
import Base
import bendvy-ecs-core@0.1.0.4/ordinary_app_registration_fields.bend as Records
import bendvy-ecs-core@0.1.0.4/execution_context.bend as Ctx
import bendvy-ecs-core@0.1.0.4/system.bend as Sys
import bendvy-ecs-core@0.1.0.4/captured_schedule_composition.bend as Identity

94# Advanced owner-preserving routing: fold left metadata, dispatch left if its id
95# is present, otherwise delegate to right. Return both actual owners and tag failed
96# outcomes LeftError/RightError. This is not two-system execution, global duplicate
97# id validation or an extra transaction; each dispatcher supplies its own contract.
98def dispatch_pair(~S:Data,~World:Type,~L:Type,~R:Type,~LE:Data,~RE:Data,~fold:L -> L & List<&2,Records.Fields<S>>,~left:L -> Ctx.Context<World> -> U32 -> L & Sys.Outcome<Ctx.Context<World>,LE,Unit>,~right:R -> Ctx.Context<World> -> U32 -> R & Sys.Outcome<Ctx.Context<World>,RE,Unit>,owners:L & R,world:Ctx.Context<World>,id:U32) -> (L & R) & Sys.Outcome<Ctx.Context<World>,Identity.Choice<LE,RE>,Unit>:
99  match owners:
100    case (a,b):dispatch_folded(~S,~World,~L,~R,~LE,~RE,~left,~right,b,world,id,fold(a))

Uses (10)

Used by (8)