ordinary_resource_field_system.bend checks
raw source on the hub · import bendvy-ecs-core@0.1.0.6/ordinary_resource_field_system.bend as Ordinary_resource_field_system
12 imports
import Base import ./trace_facts.bend as TraceFacts import ./resource_field_binding.bend as B import ./resource_field.bend as Field import ./ordinary_schema.bend as Schema import ./ordinary_query_declaration.bend as Q import ./ordinary_resource_system.bend as Whole import ./owner_product.bend as Product import ./world.bend as W import ./system.bend as Sys import ./transaction.bend as T import ./capabilities.bend as Cap
Types
type Read source · line 16 · raw
@-S:Data -> @-P:Type -> @-identity:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_schema.Resource<S, P> -> @-H:Type -> @-V:Data -> Type
Descriptor identity is retained in each operation type, including equal payloads. Identity-indexed selected-resource read grant for detached V and opaque H. Equal payload types do not erase the retained resource identity.
Read@-S:Data -> @-P:Type -> @-identity:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_schema.Resource<S, P> -> @-H:Type -> @-V:Data -> @operation:0x14a72e1c180a5ab1f8a056d43822425c/capabilities.ValueRead<H, V> -> Read<S, P, identity, H, V>
type Write source · line 20 · raw
@-S:Data -> @-P:Type -> @-identity:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_schema.Resource<S, P> -> @-H:Type -> @-V:Data -> Type
Identity-indexed selected-resource read/replacement grant. Consumes actual P while siblings remain behind the canonical lens; no incoming recovery receipt.
Write@-S:Data -> @-P:Type -> @-identity:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_schema.Resource<S, P> -> @-H:Type -> @-V:Data -> @operation:0x14a72e1c180a5ab1f8a056d43822425c/capabilities.ValueWrite<H, P, V> -> Write<S, P, identity, H, V>
type Declaration source · line 46 · raw
@-S:Data -> @-H:Type -> @-Ops:Type -> Type
Operational grants and ordered resource clauses retained together. Canonical builders bind identity to the selected lens; forged raw values are trusted setup.
Declaration@-S:Data -> @-H:Type -> @-Ops:Type -> @grant:Ops -> @clauses:List<&2, 0x14a72e1c180a5ab1f8a056d43822425c/ordinary_query_declaration.Clause<S>> -> Declaration<S, H, Ops>
type Owner source · line 84 · raw
@-S:Data -> @-Registry:Type -> @-clauses:List<&2, 0x14a72e1c180a5ab1f8a056d43822425c/ordinary_query_declaration.Clause<S>> -> Type
Only actual Registry is runtime-owned; clauses are an erased generated index. Actual registry owner indexed by erased generated field clauses; no copied resource payload or independent runtime clause registry is stored.
Owner@-S:Data -> @-Registry:Type -> @-clauses:List<&2, 0x14a72e1c180a5ab1f8a056d43822425c/ordinary_query_declaration.Clause<S>> -> @registry:Registry -> Owner<S, Registry, clauses>
type Defined source · line 88 · raw
@-S:Data -> @-World:Type -> @-Registry:Type -> @-clauses:List<&2, 0x14a72e1c180a5ab1f8a056d43822425c/ordinary_query_declaration.Clause<S>> -> Type
Registration result returning World on success/refusal, with Owner only after successful registry creation. This does not execute the resource body.
Defined@-S:Data -> @-World:Type -> @-Registry:Type -> @-clauses:List<&2, 0x14a72e1c180a5ab1f8a056d43822425c/ordinary_query_declaration.Clause<S>> -> @world:World -> @owner:Owner<S, Registry, clauses> -> Defined<S, World, Registry, clauses>
Rejected@-S:Data -> @-World:Type -> @-Registry:Type -> @-clauses:List<&2, 0x14a72e1c180a5ab1f8a056d43822425c/ordinary_query_declaration.Clause<S>> -> @world:World -> Defined<S, World, Registry, clauses>
Templates
template read_field source · line 23 · raw
@-S:Data -> @-P:Type -> @-identity:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_schema.Resource<S, P> -> @-H:Type -> @-V:Data -> @cap:Read<S, P, identity, H, V> -> @_:H -> Pair(H, V)
Advanced projection of the closed read operation, without invoking it.
template read_value source · line 27 · raw
@-S:Data -> @-P:Type -> @-identity:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_schema.Resource<S, P> -> @-H:Type -> @-V:Data -> @-cap:Read<S, P, identity, H, V> -> @owner:H -> Pair(H, V)
Read detached V through the declared selected-field grant and return actual H.
template get_field source · line 30 · raw
@-S:Data -> @-P:Type -> @-identity:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_schema.Resource<S, P> -> @-H:Type -> @-V:Data -> @cap:Write<S, P, identity, H, V> -> @_:H -> Pair(H, V)
Advanced projection of the read operation from a selected-field write grant.
template get source · line 34 · raw
@-S:Data -> @-P:Type -> @-identity:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_schema.Resource<S, P> -> @-H:Type -> @-V:Data -> @-cap:Write<S, P, identity, H, V> -> @owner:H -> Pair(H, V)
Read detached V through a write-capable field grant without replacing P.
template set_field source · line 37 · raw
@-S:Data -> @-P:Type -> @-identity:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_schema.Resource<S, P> -> @-H:Type -> @-V:Data -> @cap:Write<S, P, identity, H, V> -> @_:H -> @_:P -> H
Advanced projection of the consuming selected-field setter.
template set source · line 42 · raw
@-S:Data -> @-P:Type -> @-identity:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_schema.Resource<S, P> -> @-H:Type -> @-V:Data -> @-cap:Write<S, P, identity, H, V> -> @owner:H -> @replacement:P -> H
Consume replacement P and return H through the bound setter. Adds no extra validation, transaction finish or owned refusal result beyond that operation.
template read source · line 50 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-P:Type -> @-Rest:Type -> @-V:Data -> @-lens:0x14a72e1c180a5ab1f8a056d43822425c/owner_product.Lens<R, P, Rest> -> @-identity:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_schema.Resource<S, P> -> @-binding:0x14a72e1c180a5ab1f8a056d43822425c/resource_field_binding.Binding<S, R, P, Rest, lens, identity> -> @-view:(@_:P -> Pair(P, V)) -> Declaration<S, 0x14a72e1c180a5ab1f8a056d43822425c/transaction.Tx<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, E>, Read<S, P, identity, 0x14a72e1c180a5ab1f8a056d43822425c/transaction.Tx<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, E>, V>>
Build a selected-field read declaration from its canonical binding and view. view must return actual P with detached V; canonical lenses preserve siblings.
template write source · line 55 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-P:Type -> @-Rest:Type -> @-V:Data -> @-lens:0x14a72e1c180a5ab1f8a056d43822425c/owner_product.Lens<R, P, Rest> -> @-identity:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_schema.Resource<S, P> -> @-binding:0x14a72e1c180a5ab1f8a056d43822425c/resource_field_binding.Binding<S, R, P, Rest, lens, identity> -> @-view:(@_:P -> Pair(P, V)) -> Declaration<S, 0x14a72e1c180a5ab1f8a056d43822425c/transaction.Tx<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, E>, Write<S, P, identity, 0x14a72e1c180a5ab1f8a056d43822425c/transaction.Tx<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, E>, V>>
Build a selected-P replacement declaration with canonical binding identity. Ordinary inverse journaling restores old P on failure; successful setters consume replacement P without returning displaced payloads as a recovery receipt.
template pair source · line 59 · raw
@-S:Data -> @-H:Type -> @-L:Type -> @-R:Type -> @left:Declaration<S, H, L> -> @right:Declaration<S, H, R> -> Declaration<S, H, 0x14a72e1c180a5ab1f8a056d43822425c/capabilities.Bundle<L, R>>
Compose grants and clauses left before right, retaining both operations. This does not deduplicate clauses or add a new alias/overlap policy.
template grant source · line 63 · raw
@-S:Data -> @-H:Type -> @-Ops:Type -> @value:Declaration<S, H, Ops> -> Ops
Advanced projection of stored operational caps, without invocation.
template clauses source · line 67 · raw
@-S:Data -> @-H:Type -> @-Ops:Type -> @value:Declaration<S, H, Ops> -> List<&2, 0x14a72e1c180a5ab1f8a056d43822425c/ordinary_query_declaration.Clause<S>>
Advanced projection of detached clauses derived alongside the operational caps.
template access source · line 72 · raw
@-S:Data -> @clauses:List<&2, 0x14a72e1c180a5ab1f8a056d43822425c/ordinary_query_declaration.Clause<S>> -> List<&2, String>
Ordered clause-name projection for registration, preserving duplicates/order. No string normalization grants additional field authority.
template runner source · line 79 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Ops:(@_:Type -> Type) -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-declaration:Declaration<S, 0x14a72e1c180a5ab1f8a056d43822425c/transaction.Tx<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, E>, Ops(0x14a72e1c180a5ab1f8a056d43822425c/transaction.Tx<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, E>)> -> @-body:(@-H:Type -> @-caps:Ops(H) -> @_:Args -> @_:H -> Pair(H, Pair(0x14a72e1c180a5ab1f8a056d43822425c/transaction.Outcome<Error>, Out))) -> @world:0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E> -> @args:Args -> 0x14a72e1c180a5ab1f8a056d43822425c/system.Outcome<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Error, Out>
Execute body once with opaque Tx caps from this field declaration and finish the ECS transaction. Failure restores recorded fields, discards Out and suppresses staged work; canonical lenses preserve siblings. No implicit structural barrier.
template registered source · line 91 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-run:(@_:0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E> -> @_:Args -> 0x14a72e1c180a5ab1f8a056d43822425c/system.Outcome<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Error, Out>) -> @-clauses:List<&2, 0x14a72e1c180a5ab1f8a056d43822425c/ordinary_query_declaration.Clause<S>> -> @result:0x14a72e1c180a5ab1f8a056d43822425c/system.RegistrationResult<S, C, R, E, Args, Error, Out, run> -> Defined<S, 0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, 0x14a72e1c180a5ab1f8a056d43822425c/system.Registry<S, C, R, E, Args, Error, Out, run>, clauses>
template define source · line 98 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Ops:(@_:Type -> Type) -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-declaration:Declaration<S, 0x14a72e1c180a5ab1f8a056d43822425c/transaction.Tx<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, E>, Ops(0x14a72e1c180a5ab1f8a056d43822425c/transaction.Tx<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, E>)> -> @-body:(@-H:Type -> @-caps:Ops(H) -> @_:Args -> @_:H -> Pair(H, Pair(0x14a72e1c180a5ab1f8a056d43822425c/transaction.Outcome<Error>, Out))) -> @world:0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E> -> @name:String -> Defined<S, 0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, 0x14a72e1c180a5ab1f8a056d43822425c/system.Registry<S, C, R, E, Args, Error, Out, runner(S, C, R, E, Ops, Args, Error, Out, declaration, body)>, clauses(S, 0x14a72e1c180a5ab1f8a056d43822425c/transaction.Tx<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, E>, Ops(0x14a72e1c180a5ab1f8a056d43822425c/transaction.Tx<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, E>), declaration)>
Register the field declaration/body using ordered derived access clauses. Bindings, lenses and view functions are trusted setup, not arbitrary metadata validation. Higher-level ordinary App resource-field declarations expose this.
template run source · line 103 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-run:(@_:0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E> -> @_:Args -> 0x14a72e1c180a5ab1f8a056d43822425c/system.Outcome<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Error, Out>) -> @-clauses:List<&2, 0x14a72e1c180a5ab1f8a056d43822425c/ordinary_query_declaration.Clause<S>> -> @owner:Owner<S, 0x14a72e1c180a5ab1f8a056d43822425c/system.Registry<S, C, R, E, Args, Error, Out, run>, clauses> -> @world:0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E> -> @args:Args -> 0x14a72e1c180a5ab1f8a056d43822425c/system.RunResult<S, C, R, E, Args, Error, Out, run>
Run the actual registry through Sys.run. Full refusal returns registry, World and unconsumed Args; normal completion retains the returned registry and World. This wrapper does not execute the deferred command barrier.
template runner_observed source · line 110 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Ops:(@_:Type -> Type) -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-declaration:Declaration<S, 0x14a72e1c180a5ab1f8a056d43822425c/transaction.Tx<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, E>, Ops(0x14a72e1c180a5ab1f8a056d43822425c/transaction.Tx<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, E>)> -> @-body:(@-H:Type -> @-caps:Ops(H) -> @_:Args -> @_:H -> Pair(H, Pair(0x14a72e1c180a5ab1f8a056d43822425c/transaction.Outcome<Error>, Out))) -> @trace:0x14a72e1c180a5ab1f8a056d43822425c/trace_facts.State -> @world:0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E> -> @args:Args -> Pair(0x14a72e1c180a5ab1f8a056d43822425c/system.Outcome<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Error, Out>, 0x14a72e1c180a5ab1f8a056d43822425c/trace_facts.State)
Trace-aware counterpart of runner with supplied/returned fact state. Same caps, transaction decision and output disposal; observation adds no resource authority and does not make attempted writes committed.