local.bend checks
raw source on the hub · import bendvy-ecs-core@0.1.0.1/local.bend as Local
4 imports
import Base import ./change_tick.bend as Tick import ./world.bend as W import ./registration.bend as Reg
Types
type Outcome source · line 10 · raw
@World:Type -> @L:Type -> @Error:Data -> @Out:Type -> Type
Runner identity is a closed erased index; each registration owns its Local. Runner completion retaining World and the returned Local owner on both success and failure. Only success returns Out; failure does not automatically restore Local or recover body outputs. Runner defines World rollback behavior.
Succeeded@World:Type -> @L:Type -> @Error:Data -> @Out:Type -> @world:World -> @local:L -> @output:Out -> Outcome<World, L, Error, Out>
Failed@World:Type -> @L:Type -> @Error:Data -> @Out:Type -> @world:World -> @local:L -> @error:Error -> Outcome<World, L, Error, Out>
type Instance source · line 16 · raw
@S:Data -> @C:Type -> @R:Type -> @E:Data -> @L:Type -> @Args:Type -> @Error:Data -> @Out:Type -> @-runner:(@_:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @_:L -> @_:Args -> Outcome<0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E>, L, Error, Out>) -> Type
Affine per-registration Local owner with runtime namespace and actual registration metadata. L may be arbitrary Type; no other registration shares it implicitly. Raw construction is trusted administration.
Instance@S:Data -> @C:Type -> @R:Type -> @E:Data -> @L:Type -> @Args:Type -> @Error:Data -> @Out:Type -> @-runner:(@_:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @_:L -> @_:Args -> Outcome<0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E>, L, Error, Out>) -> @namespace:U32 -> @id:U32 -> @name:String -> @access:List<&2, String> -> @local:L -> Instance<S, C, R, E, L, Args, Error, Out, runner>
type Registered source · line 20 · raw
@S:Data -> @C:Type -> @R:Type -> @E:Data -> @L:Type -> @Args:Type -> @Error:Data -> @Out:Type -> @-runner:(@_:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @_:L -> @_:Args -> Outcome<0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E>, L, Error, Out>) -> Type
Registered returns World and the Local instance; RegistrationRejected returns World and the original Local owner without invoking the runner.
Registered@S:Data -> @C:Type -> @R:Type -> @E:Data -> @L:Type -> @Args:Type -> @Error:Data -> @Out:Type -> @-runner:(@_:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @_:L -> @_:Args -> Outcome<0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E>, L, Error, Out>) -> @world:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @instance:Instance<S, C, R, E, L, Args, Error, Out, runner> -> Registered<S, C, R, E, L, Args, Error, Out, runner>
RegistrationRejected@S:Data -> @C:Type -> @R:Type -> @E:Data -> @L:Type -> @Args:Type -> @Error:Data -> @Out:Type -> @-runner:(@_:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @_:L -> @_:Args -> Outcome<0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E>, L, Error, Out>) -> @world:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @local:L -> Registered<S, C, R, E, L, Args, Error, Out, runner>
type Run source · line 26 · raw
@S:Data -> @C:Type -> @R:Type -> @E:Data -> @L:Type -> @Args:Type -> @Error:Data -> @Out:Type -> @-runner:(@_:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @_:L -> @_:Args -> Outcome<0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E>, L, Error, Out>) -> Type
Completed returns World, retained Local instance and success/error result. Refused returns those owners and original Args before runner execution. Runner failure retains its returned Local modifications, not an old copy.
Completed@S:Data -> @C:Type -> @R:Type -> @E:Data -> @L:Type -> @Args:Type -> @Error:Data -> @Out:Type -> @-runner:(@_:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @_:L -> @_:Args -> Outcome<0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E>, L, Error, Out>) -> @world:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @instance:Instance<S, C, R, E, L, Args, Error, Out, runner> -> @result:Result<&2, &1, Error, Out> -> @tick:0xf435da9e535b3846d643dad16580e35f/change_tick.Tick -> Run<S, C, R, E, L, Args, Error, Out, runner>
Refused@S:Data -> @C:Type -> @R:Type -> @E:Data -> @L:Type -> @Args:Type -> @Error:Data -> @Out:Type -> @-runner:(@_:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @_:L -> @_:Args -> Outcome<0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E>, L, Error, Out>) -> @world:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @instance:Instance<S, C, R, E, L, Args, Error, Out, runner> -> @args:Args -> Run<S, C, R, E, L, Args, Error, Out, runner>
type Disposal source · line 32 · raw
@S:Data -> @C:Type -> @R:Type -> @E:Data -> @L:Type -> @Args:Type -> @Error:Data -> @Out:Type -> @-runner:(@_:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @_:L -> @_:Args -> Outcome<0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E>, L, Error, Out>) -> @Disposed:Type -> Type
Disposed returns World and output of the explicit disposeLocal callback. DisposalRejected returns World and original instance without invoking that callback; no implicit finalizer is invented by dropping a result variant.
Disposed@S:Data -> @C:Type -> @R:Type -> @E:Data -> @L:Type -> @Args:Type -> @Error:Data -> @Out:Type -> @-runner:(@_:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @_:L -> @_:Args -> Outcome<0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E>, L, Error, Out>) -> @Disposed:Type -> @world:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @output:Disposed -> Disposal<S, C, R, E, L, Args, Error, Out, runner, Disposed>
DisposalRejected@S:Data -> @C:Type -> @R:Type -> @E:Data -> @L:Type -> @Args:Type -> @Error:Data -> @Out:Type -> @-runner:(@_:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @_:L -> @_:Args -> Outcome<0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E>, L, Error, Out>) -> @Disposed:Type -> @world:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @instance:Instance<S, C, R, E, L, Args, Error, Out, runner> -> Disposal<S, C, R, E, L, Args, Error, Out, runner, Disposed>
type Cell source · line 39 · raw
@L:Type -> Type
Rank-2 provider: callbacks get declared operations, not the concrete cell. Trusted implementation cell for opaque Local capability callbacks. Ordinary bodies receive abstract H and Ops, not this concrete owner.
Cell@L:Type -> @local:L -> Cell<L>
type Ops source · line 44 · raw
@H:Type -> @L:Type -> @V:Data -> Type
Opaque Local read/replacement operations. read returns detached Data V; replace consumes L and returns H without a displaced-owner receipt. Use explicit recovery APIs if replacement must return the displaced owner.
Ops@H:Type -> @L:Type -> @V:Data -> @read:(@_:H -> Pair(H, V)) -> @replace:(@_:H -> @_:L -> H) -> Ops<H, L, V>
Templates
template projected source · line 46 · raw
@-L:Type -> @-V:Data -> @result:Pair(L, V) -> Pair(Cell<L>, V)
template read_cell source · line 49 · raw
@-L:Type -> @-V:Data -> @-project:(@_:L -> Pair(L, V)) -> @cell:Cell<L> -> Pair(Cell<L>, V)
template replace_cell source · line 53 · raw
@-L:Type -> @cell:Cell<L> -> @local:L -> Cell<L>
template modify_cell source · line 56 · raw
@-L:Type -> @cell:Cell<L> -> @modify:(@_:L -> L) -> Cell<L>
template unwrapped source · line 59 · raw
@-L:Type -> @-Out:Type -> @result:Pair(Cell<L>, Out) -> Pair(L, Out)
template provide source · line 66 · raw
@-L:Type -> @-V:Data -> @-Out:Type -> @-project:(@_:L -> Pair(L, V)) -> @-consume:(@-H:Type -> @_:Ops<H, L, V> -> @_:H -> Pair(H, Out)) -> @local:L -> Pair(L, Out)
Run a universally quantified Local body through read/replace capabilities. Returns the retained Local owner and Out. project must preserve its L owner; replacement does not invoke a finalizer or journal arbitrary mutations. Contract and accepted scenarios: docs/design/public-local-policy.md.
template provide_with source · line 72 · raw
@-L:Type -> @-V:Data -> @-Args:Type -> @-Out:Type -> @-project:(@_:L -> Pair(L, V)) -> @-consume:(@-H:Type -> @_:Ops<H, L, V> -> @_:H -> @_:Args -> Pair(H, Out)) -> @local:L -> @args:Args -> Pair(L, Out)
Local capability invocation with affine Args and Out, returning retained L. As with provide, the opaque body gets no concrete cell and the caller must handle any operation-specific ownership/recovery it requires.
template register_result source · line 75 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-L:Type -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-runner:(@_:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @_:L -> @_:Args -> Outcome<0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E>, L, Error, Out>) -> @registered:Pair(0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E>, 0xf435da9e535b3846d643dad16580e35f/world.Registration) -> @+namespace:U32 -> @+name:String -> @+access:List<&2, String> -> @local:L -> Registered<S, C, R, E, L, Args, Error, Out, runner>
template register_named source · line 79 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-L:Type -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-runner:(@_:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @_:L -> @_:Args -> Outcome<0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E>, L, Error, Out>) -> @named:Pair(0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E>, U32) -> @+name:String -> @+access:List<&2, String> -> @local:L -> Registered<S, C, R, E, L, Args, Error, Out, runner>
template register source · line 85 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-L:Type -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-runner:(@_:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @_:L -> @_:Args -> Outcome<0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E>, L, Error, Out>) -> @world:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @name:String -> @access:List<&2, String> -> @local:L -> Registered<S, C, R, E, L, Args, Error, Out, runner>
Register a closed runner and consume its initial Local owner. Returns instance on success, original Local on refusal, and World on both paths. Raw access strings are trusted metadata; ordinary wrappers derive them.
template completed source · line 88 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-L:Type -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-runner:(@_:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @_:L -> @_:Args -> Outcome<0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E>, L, Error, Out>) -> @namespace:U32 -> @id:U32 -> @name:String -> @access:List<&2, String> -> @tick:0xf435da9e535b3846d643dad16580e35f/change_tick.Tick -> @outcome:Outcome<0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E>, L, Error, Out> -> Run<S, C, R, E, L, Args, Error, Out, runner>
template entered source · line 92 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-L:Type -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-runner:(@_:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @_:L -> @_:Args -> Outcome<0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E>, L, Error, Out>) -> @namespace:U32 -> @id:U32 -> @name:String -> @access:List<&2, String> -> @local:L -> @args:Args -> @observed:Pair(0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E>, 0xf435da9e535b3846d643dad16580e35f/change_tick.Tick) -> Run<S, C, R, E, L, Args, Error, Out, runner>
template checked source · line 95 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-L:Type -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-runner:(@_:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @_:L -> @_:Args -> Outcome<0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E>, L, Error, Out>) -> @allowed:Bool -> @instance:Instance<S, C, R, E, L, Args, Error, Out, runner> -> @world:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @args:Args -> Run<S, C, R, E, L, Args, Error, Out, runner>
template run source · line 103 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-L:Type -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-runner:(@_:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @_:L -> @_:Args -> Outcome<0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E>, L, Error, Out>) -> @instance:Instance<S, C, R, E, L, Args, Error, Out, runner> -> @world:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @args:Args -> Run<S, C, R, E, L, Args, Error, Out, runner>
Validate namespace and live registration metadata before invoking runner. Refused returns original Args/instance/World. Completed retains the Local returned by the runner even on error; World rollback is the runner's job. This primitive has no query lifecycle cursor of its own.
template skip source · line 108 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-L:Type -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-runner:(@_:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @_:L -> @_:Args -> Outcome<0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E>, L, Error, Out>) -> @instance:Instance<S, C, R, E, L, Args, Error, Out, runner> -> Instance<S, C, R, E, L, Args, Error, Out, runner>
Return the same Local instance without invoking a body or modifying L.
template identity source · line 113 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-L:Type -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-runner:(@_:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @_:L -> @_:Args -> Outcome<0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E>, L, Error, Out>) -> @instance:Instance<S, C, R, E, L, Args, Error, Out, runner> -> Pair(Instance<S, C, R, E, L, Args, Error, Out, runner>, U32)
Return the retained instance and registration ID without running a body. An observed ID does not bypass namespace/live-registration validation.
template observed source · line 116 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-L:Type -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-runner:(@_:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @_:L -> @_:Args -> Outcome<0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E>, L, Error, Out>) -> @-V:Data -> @namespace:U32 -> @id:U32 -> @name:String -> @access:List<&2, String> -> @value:Pair(L, V) -> Pair(Instance<S, C, R, E, L, Args, Error, Out, runner>, V)
template observe source · line 122 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-L:Type -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-runner:(@_:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @_:L -> @_:Args -> Outcome<0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E>, L, Error, Out>) -> @-V:Data -> @-project:(@_:L -> Pair(L, V)) -> @instance:Instance<S, C, R, E, L, Args, Error, Out, runner> -> Pair(Instance<S, C, R, E, L, Args, Error, Out, runner>, V)
Return the instance with a detached Data projection of Local. project must return its L owner; this trusted callback is not a World transaction and grants no authority to execute a registration in another World.
template disposal source · line 126 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-L:Type -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-runner:(@_:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @_:L -> @_:Args -> Outcome<0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E>, L, Error, Out>) -> @-Disposed:Type -> @-disposeLocal:(@_:L -> Disposed) -> @instance:Instance<S, C, R, E, L, Args, Error, Out, runner> -> @result:Pair(0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E>, Bool) -> Disposal<S, C, R, E, L, Args, Error, Out, runner, Disposed>
template dispose source · line 134 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-L:Type -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-runner:(@_:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> @_:L -> @_:Args -> Outcome<0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E>, L, Error, Out>) -> @-Disposed:Type -> @-disposeLocal:(@_:L -> Disposed) -> @instance:Instance<S, C, R, E, L, Args, Error, Out, runner> -> @world:0xf435da9e535b3846d643dad16580e35f/world.World<S, C, R, E> -> Disposal<S, C, R, E, L, Args, Error, Out, runner, Disposed>
Remove the matching live registration, then consume L once with the explicit disposeLocal callback and return its output. Refusal retains instance/World without calling disposeLocal. Arbitrary callback effects are outside ECS rollback; inspect the result instead of assuming disposal.