A stack is a strictly nested sequence of obligations such that what was opened last must close first. The defining commitment is the last-in-first-out discipline: the closing order is not free — it is fully determined as the strict reverse of the opening order.
Think of a pile of plates. You can only put a new plate on the very top, and you can only take the top one off. The plate you put down last is the first one you pick back up. You can't grab a plate from the middle without taking off the ones above it first.
Last On, First Off
A stack is a way of keeping things in order where the last item you add is the first one you remove. You always add to the top and always remove from the top — like a pile of plates or a stack of books. This makes a strict rule: if you put A down before B, then B has to come off before A. It is perfect for things that nest, like opening boxes inside boxes: you have to close the inner box before the outer one. The order you close in isn't free — it's exactly the reverse of the order you opened in.
Last-In, First-Out
A stack is the structural pattern of a strictly nested sequence of obligations or activations such that what was opened last must be closed first. Its defining commitment is the last-in-first-out discipline: items are pushed onto the top in some opening order, popped from the top in the strict reverse of that order, and never retrieved from beneath the top while items remain above. What makes it a real pattern, not just a 'list,' is the strict nesting: if A was pushed before B, then B must be popped before A, an inviolable relationship. That enforced nesting is what separates a stack from a queue, a priority queue, or a set, and it is why stacks naturally represent nested obligations — function calls, scope contexts, parenthesized structures, backtrackable searches. The order of closing is fully determined: it is the order of opening, reversed.
A stack is the structural pattern of a strictly nested sequence of obligations or activations such that what was opened last must be closed first. The defining commitment is the last-in-first-out discipline: items are pushed onto the top in some opening order, items must be popped from the top in the strict reverse of that order, and no item may be retrieved from beneath the top while items remain above it. What makes the stack a structural pattern rather than mere 'list' is the strict nesting: the discipline enforces that any pair of items maintains an inviolable relationship — if A was pushed before B, then B must be popped before A. This enforced nesting distinguishes the stack from other ordering structures — queue, priority queue, set — and makes stacks the natural representation of nested obligations, call activations, scope contexts, parenthesized structures, and step-by-step backtrackable explorations. The order of closing is not free; it is fully determined by the order of opening, reversed. The pattern travels because the same nested-obligation structure appears across substrates: a function call cannot return until functions it called have returned; an interpretation cannot pop a parenthesis level until inner levels close; a search cannot retract a decision until downstream decisions are unwound; a person multitasking cannot resume an outer task until inner tasks complete; a legal argument depending on a precedent cannot be finalized until the precedent's status settles. In each case the operational rule is identical — the topmost obligation must complete first — and the geological case of sedimentary strata, oldest at the bottom, shows the structure arising in nature with no human discipline imposing it.
It separates nested obligations (which require LIFO) from parallel or ordered ones; resuming an outer obligation without closing the inner one leaves the system inconsistent.
It compresses nested-obligation phenomena into one rule — a nested opening sequence implies a reversed closing sequence — and sorts interventions (limit depth, convert recursion to iteration, install unwind handlers, detect mismatched push/pop pairs).
It names the nested-versus-parallel distinction, the stack-depth-versus-resource tradeoff, the bracket-matching invariant (every push eventually matched by a pop), and the unwinding-on-failure discipline.
Evaluating ( 3 + ( 4 * 2 ) ) pushes the outer sum, then the inner product, which becomes the top; the LIFO invariant forces 4 * 2 to be discharged (popped) before the addition can resume — and an unmatched parenthesis is diagnosed as a specific stack fault.
Stack is not a Hierarchy because a hierarchy is a static containment tree traversable in any order, whereas a stack is a dynamic temporal discipline fixing the order of discharge over time.
Stack is not Recursion because recursion is self-reference in a definition, whereas a stack is the runtime mechanism that often implements it — but stacks arise without self-reference and recursion can run without an explicit stack.
Stack is not Interleaving because interleaving permits free alternation between independent strands, whereas a stack forbids touching any item beneath the top.