Metasyntactic Variable
a placeholder identifier chosen to carry no meaning of its own.
A metasyntactic variable is a placeholder name used in an example, template, or explanation where the identity of the thing named does not matter — only its role. English computing culture settled on foo and bar (with baz and further nonsense words as more slots are needed); other traditions developed their own sets independently, among them toto in French-language examples and hoge in Japanese ones. None of these names encode any property of what they stand for, which is the entire point.
A popular derivation traces foo and bar to the WWII army slang acronym FUBAR. The hedge belongs on only half of that. Foo on its own is older, attested throughout Bill Holman's Smokey Stover comic strips from the 1930s and so predating the acronym; an account making FUBAR the sole source of the word is Folk Etymology. The pairing is a separate claim, and both RFC 3092 and the Jargon File accept it — the specific coupling of foo with bar was probably shaped by FUBAR, even though the nonsense word it drew on was already in circulation.
The reason the convention matters is what it protects against. A real-sounding placeholder — userID, orderTotal — smuggles a domain assumption into an example that is supposed to be about structure, not content, costing the reader effort resolving a meaning that was never intended to exist. Naming is normally the discipline of choosing an identifier that states its contract, as covered under Naming; a metasyntactic variable is the deliberate exception, built to state nothing.
Because each set arose locally, the choice of foo, toto, or hoge in a given codebase or textbook works as an informal marker of which teaching tradition produced it, in something like the way a dialect word functions as a Shibboleth for a speech community. The sets rarely mix within one example; picking one and using it consistently is itself a small act of legibility.
See also5
Hand-picked in the note itself — the neighbours worth reading next.
Naming
Choosing identifiers so the code states its own meaning without commentary.
Method55 connections
Folk Etymology
Words reshaped to resemble familiar parts, and the false origin stories that reshaping invites.
Meaning & Society15 connections
Shibboleth
A pronunciation or usage that reveals group membership, historically used as a test with lethal stakes.
Meaning & Society9 connections
Reproducible Case
The smallest set of steps that reliably produces a fault, and the unit of real debugging.
Method25 connections
Linguistic Relativity
The hypothesis that language shapes thought, and the evidence that has narrowed it considerably.
Meaning & Society17 connections
Related5
Nearby in the graph rather than deliberately chosen. Looser, sometimes surprising.
Linked from2
Notes elsewhere in the wiki that reach for this one.