Metasyntactic variable
In computer programming, a metasyntactic variable is a name used in examples and understood by hackers and programmers to stand for whatever thing is under discussion, or any random member of a class of things under discussion. The word foo is the canonical example.
Metasyntactic variables are so called because:
- they are variables in the metalanguage used to talk about programs etc (see also pseudocode);
- they are variables whose values are often variables (as in usages like "the value of f( foo, bar ) is the sum of foo and bar").
However, it has been plausibly suggested that the real reason for the term metasyntactic variable is that it sounds good: the term is a piece of computer jargon.
Examples
Foo and Bar
Foo is the first metasyntactic variable commonly used. It is sometimes combined with bar to make foobar. This suggests that foo may have originated with the World War II slang term fubar, as an acronym for fucked up beyond all recognition. Foo was also used as a nonsense word in the surrealistic comic strip Smokey Stover that was popular in the 1940s and 1950s. See also Foo Fighters for more foo etymology.
Foo is a kind of alias, commonly used to represent an as-yet-unspecified term, value, process, function, destination or event, but seldom a person.
The jargon file has an extensive etymology of the word foo at [1]. The IETF also published a memo on the subject: see RFC 3092.
Baz
baz is the third metasyntactic variable, commonly used after foo and bar.
Fred & Barney
After the characters in the cartoon series The Flintstones.
xyzzy
xyzzy is from the Colossal Cave Adventure
Other examples
quux, mum, thud, beekeeper, hoge, corge, grault, garply, waldo, plugh, kalaa, puppu.
An earlier version of the above paraphrased a Jargon File article here.