B2.4.2 · dive 2 of 3 · module B2.4
Composition is a pure fold.
compose/2 folds the :extends chain with Map.merge — base first, descendants after, overrides last; resolve/3 keeps it pure by taking an injected fetch. The view is built at read time.
The idea
echo_data · bcs/archetypes.exThe composed view does not exist until it is read. compose/2 takes a chain of bundles and a map of overrides, folds the chain with Map.merge — base first, each descendant after — then merges the overrides last and drops the :extends key. Right-most wins: a descendant overrides its parent, and the entity’s overrides override them all.
Resolution stays pure by taking its boundary as an argument. resolve/3 walks the :extends chain root-first through a fetch function the caller supplies, then hands the chain to compose/2; whether fetch reads a property store or a snapshot, the composing logic is the same pure fold. The side effect is injected, so the merge itself touches nothing outside its arguments.
Codemojex composes a tile’s effective properties at the moment it needs them. The base tile, the power-up that extends it, and the placed tile’s overrides fold into one map on read — not stored pre-merged, not stale when the base changes. Change the base bundle and every entity that extends it shows the change the next time it is composed.
The doors
the sibling coursesEchoMQ — the protocol, in depth
The bus B3 narrates, taught rung by rung: the keyspace, the Lua inventory, and the 3.0 Stream Tier — XADD, XREADGROUP, XACK — with conformance on Valkey.
Redis Patterns Applied
The substrate patterns under the bus: sorted sets, atomic Lua moves, locks, and streams — the judgement layer.
/echo-persistenceEcho Persistence — the durable floor
Beneath the volatile tiers: the Graft page engine built twice, the commit-LSN loop, and the stream archive on Tigris. Where Part I says state lives somewhere, this says where it lives durably.
References
sources · relatedSources
- Helland — Life Beyond Distributed Transactions (CIDR 2007)entities as named data a system composes, not a hierarchy of code
- Erlang/OTP — the ets modulethe store a fetch reads archetype bundles from
- The Go Blog — Share Memory By Communicatinga pure core with its side effect injected, not shared state
Related
- BCS — the course homethe law, the id anatomy, the chapter map
- Echo Persistencethe durable floor beneath the bus