ordinary_app_resource_field_observation.bend

bendvy-ecs-core@0.1.0.0 · 13 lines · 0 definitions

1import Base
2import bendvy-ecs-core@0.1.0.0/world.bend as W
3import bendvy-ecs-core@0.1.0.0/ordinary_app_observation_data.bend as DTO
4import bendvy-ecs-core@0.1.0.0/ordinary_app_resource_field_declaration.bend as D
5def resource_returned(~S:Data,~C:Type,~R:Type,~E:Data,~Ops:Type -> Type,~V:Data,~declaration:D.Declaration<S,C,R,E,Ops,V>,result:W.World<S,C,R,E> & V) -> W.World<S,C,R,E> & DTO.Observation<V>:
6  match result:
7    case (world,+value):(world,DTO.Observation{value,[D.name(~S,~C,~R,~E,~Ops,~V,declaration) ++ "=" ++ D.presenter(~S,~C,~R,~E,~Ops,~V,declaration)(value)]})
8# Advanced observation bridge: invoke the declaration's trusted World observer,
9# return its World owner and detached value plus a name=presented-value row.
10# Observer/presenter effects are declaration-defined; this wrapper adds no access
11# validation, debug bypass or rollback guarantee.
12def resource_observe(~S:Data,~C:Type,~R:Type,~E:Data,~Ops:Type -> Type,~V:Data,~declaration:D.Declaration<S,C,R,E,Ops,V>,world:W.World<S,C,R,E>) -> W.World<S,C,R,E> & DTO.Observation<V>:
13  resource_returned(~S,~C,~R,~E,~Ops,~V,~declaration,D.observer(~S,~C,~R,~E,~Ops,~V,declaration)(world))