execution_registry.bend

bendvy-ecs-core@0.1.0.3 · 15 lines · 4 definitions

1import Base
2import bendvy-ecs-core@0.1.0.3/dependency_registration.bend as Reg
3import bendvy-ecs-core@0.1.0.3/dependency_executor.bend as Exec
4import bendvy-ecs-core@0.1.0.3/dependency_plan.bend as Plan
5
6type Facts<-Registry:Type> is Type:
7  Facts{registry:Registry,deferred:List<&2,U32>}
8def ordinary(~World:Type,~Owners:Type,~Error:Data,~Out:Data,~dispatch:Owners -> World -> U32 -> Owners & (World & Exec.Invocation<Error,Out>),registry:Reg.Registry<World,Owners,Error,Out,dispatch>) -> Facts<Reg.Registry<World,Owners,Error,Out,dispatch>>:
9  Facts{registry,[]}
10def command(~World:Type,~Owners:Type,~Error:Data,~Out:Data,~dispatch:Owners -> World -> U32 -> Owners & (World & Exec.Invocation<Error,Out>),registry:Reg.Registry<World,Owners,Error,Out,dispatch>) -> Facts<Reg.Registry<World,Owners,Error,Out,dispatch>>:
11  match registry:
12    case Reg.Registry{owners,+nodes}:Facts{Reg.Registry{owners,nodes},Reg.ids(nodes)}
13def paired(~World:Type,~L:Type,~R:Type,~Error:Data,~Out:Data,~leftDispatch:L -> World -> U32 -> L & (World & Exec.Invocation<Error,Out>),~rightDispatch:R -> World -> U32 -> R & (World & Exec.Invocation<Error,Out>),left:Facts<Reg.Registry<World,L,Error,Out,leftDispatch>>,right:Facts<Reg.Registry<World,R,Error,Out,rightDispatch>>) -> Facts<Reg.Registry<World,Reg.Product<L,R>,Error,Out,Reg.paired_dispatch(~World,~L,~R,~Error,~Out,~leftDispatch,~rightDispatch)>>:
14  match left right:
15    case Facts{left,ld} Facts{right,rd}:Facts{Reg.paired(~World,~L,~R,~Error,~Out,~leftDispatch,~rightDispatch,left,right),List.append(&2,U32,ld,rd)}