B2 · module 4 of 6 · Archetypes and Composition
Archetypes and Composition.
An archetype is an entity in the ARC namespace whose value is a property bundle, optionally extending one parent through :extends; an entity carries an archetype’s id plus its own overrides, and the composed view is a pure fold computed at read time.
Three dives: archetypes as data rather than code, composition as a pure fold whose boundary is injected, and the single :extends link that makes inheritance a bounded chain with no class diamond.
The three dives
each a leaf, the teachingArchetypes are data
An archetype is not a class; it is an entity. It lives in the ARC namespace and its value is a property bundle — a plain map…
Composition is a pure fold
The 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…
One parent, no diamond
A bundle extends at most one parent. That single :extends link makes inheritance a chain, never a lattice, so the diamond problem…
The module, in one law
echo_data · bcs/archetypes.exB2.4 reads archetypes as data and composition as a pure fold. An archetype is an entity in the ARC namespace whose value is a property bundle, optionally extending one parent through an :extends key; an entity carries an archetype’s id plus its own overrides; and the composed view is computed at read time by folding the chain — base first, descendants after, overrides last. Three dives: archetypes as data rather than code, composition as a pure fold whose boundary is injected, and the single :extends link that makes inheritance a bounded, cycle-checked chain with no class diamond. Grounded in EchoData.Bcs.Archetypes, and pointed at the tile and player kinds Codemojex grows at runtime.
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
- King — Announcing Snowflake (2010)the ARC id that names an archetype as an entity
- Erlang/OTP — the ets modulethe store a fetch reads archetype bundles from
Related
- BCS — the course homethe law, the id anatomy, the chapter map
- Echo Persistencethe durable floor beneath the bus