def spawn

bendvy-ecs-core@0.1.0.4 · ordinary_lifetime_scope.bend:67

import bendvy-ecs-core@0.1.0.4/ordinary_lifetime_scope.bend as OrdinaryLifetimeScope
import Base
import bendvy-ecs-core@0.1.0.4/lifetime_scope.bend as Sc
import bendvy-ecs-core@0.1.0.4/capabilities.bend as Cap

67# Request a deferred spawn in a scope from this World's namespace.
68# Returns the updated opaque owner and either Spawned{handle}, a reserved handle
69# not yet live, or SpawnRejected{payload,error}, returning the incoming affine P.
70# A foreign-world scope is refused; reservation exhaustion also returns payload.
71# Accepted requests retain P in deferred work. At an explicit command barrier,
72# activation/populate precede membership assignment; the body does not see a live
73# entity merely because this request succeeded. Only immediate refusal promises
74# that payload result: a later failed system discards its Out and staged work,
75# so placing rejected P inside Out does not make it a failed-system recovery API.
76def spawn(~H:Type,~S:Data,~P:Type,~ops:Ops<H,S,P>,owner:H,scope:Sc.Scope<S>,payload:P) -> H & Sc.SpawnResult<S,P>:
77  Cap.owned_request(~H,~(Sc.Scope<S> & P),~Sc.SpawnResult<S,P>,~spawn_cap(~H,~S,~P,ops),owner,(scope,payload))

Uses (7)

Used by (0)

No other definition uses this definition.