marshalling — marshalling — pack an object into an ordered stream so it can cross a boundary
marshal [--in-order] [--no-partial] OBJECT > wire unmarshal < wire > OBJECT wire := marshal(object); object := unmarshal(wire)
marshal takes an OBJECT — a thing that exists only as a cluster of fields sitting near each other in one address space — and lays it out as a single ordered stream fit to travel across a process, machine, or protocol boundary. The inverse, unmarshal, receives that stream on the far side and rebuilds the object from it. A pointer is meaningless once it leaves the room it was born in; marshalling is the act of turning proximity into sequence so the far side has something to read.
Order is the whole contract. The receiver reads the stream field by field in the sequence the sender wrote it, and there is no seeking back. A stream that arrives shuffled, truncated, or missing its length prefix does not degrade gracefully — it is refused at the gate. marshal writes nothing until every field is in its slot; the bridge does not accept partial data.
marshalling is not encryption, not compression, and not validation, though it is frequently mistaken for all three by callers who wanted those instead.
"From Old High German marahscalc, literally horse-servant (marah, horse; scalc, servant) — the man who kept the stables, an office that rose with cavalry until a field marshal commanded armies. The sense of arranging things into order gave English the marshalling yard, where locomotives shunt scattered wagons into ordered trains. Computing borrowed the term for serialization in the era of remote procedure calls; Sun RPC's XDR and later Microsoft COM/DCOM made marshalling arguments across a boundary a daily chore, and gRPC with Protocol Buffers carries the schema-checked version everywhere today."
--deep on a self-referential object recurses until the stack is a monument to the attempt. Documented as depth-first.
Marshalling and serialization are the same operation with two priesthoods that do not attend each other's conferences.
A field added on one side and not the other unmarshals into silence. Silence exits 0. This is by design and no one is happy about it.
thunk(3), backpressure(3), idempotent(3). The living exhibit demonstrates the word in motion:
▸ operate marshalling