def write

bendvy-ecs-core@0.1.0.4 · ordinary_app_resource_field_declaration.bend:49

import bendvy-ecs-core@0.1.0.4/ordinary_app_resource_field_declaration.bend as OrdinaryAppResourceFieldDeclaration
import Base
import bendvy-ecs-core@0.1.0.4/ordinary_query_declaration.bend as Query
import bendvy-ecs-core@0.1.0.4/resource_field_binding.bend as Binding
import bendvy-ecs-core@0.1.0.4/resource_field.bend as Lens
import bendvy-ecs-core@0.1.0.4/ordinary_resource_field_system.bend as Field
import bendvy-ecs-core@0.1.0.4/ordinary_schema.bend as Schema
import bendvy-ecs-core@0.1.0.4/owner_product.bend as Product
import bendvy-ecs-core@0.1.0.4/world.bend as W

49# Declare selected-field read/replacement access through the canonical binding.
50# The setter journals the displaced field and threads siblings through the lens;
51# a failed transaction restores its recorded field owner. With tracing enabled,
52# the declared view/render functions supply before/after resource observations.
53# view returns P with its observation; render receives only detached V and
54# returns String. This is not general rollback for projector side effects or IO. For explicit displaced/rejected owner
55# recovery, use ordinary-recovery-resource-field rather than this declaration.
56def write(~S:Data,~C:Type,~R:Type,~E:Data,~P:Type,~Rest:Type,~V:Data,~lens:Product.Lens<R,P,Rest>,~identity:Schema.Resource<S,P>,~binding:Binding.Binding<S,R,P,Rest,lens,identity>,~view:P -> P & V,~render:V -> String) -> Declaration<S,C,R,E,write_ops(~S,~P,~identity,~V),V>:
57  Declaration{Field.Declaration{Field.Write{Lens.write_observed(~S,~C,~R,~E,~P,~Rest,~V,~lens,~view,~render,~Schema.resource_key(~S,~P,identity))},[Query.Clause{Schema.resource_key(~S,~P,identity),Query.Write{}}]},W.observe_resource(~S,~C,~R,~E,~V,~Lens.project(~R,~P,~Rest,~V,~lens,~view)),render}

Uses (16)

Used by (0)

No other definition uses this definition.