Main Page | Recent changes | Edit this page | Page history

Printable version

Not logged in
Log in | Help
 

Metasyntactic variable

(Redirected from Foo)

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:

  1. they are variables in the metalanguage used to talk about programs etc (see also pseudocode);
  2. 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.

Table of contents

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.

J. Random

J. Random is the name of an archetypical user, compare to "The Jones'".

Alice and Bob

Alice and Bob are names of the archetypal individuals used as examples in discussions of cryptographic protocols. Others include Carol (a participant in three- and four-party protocols), Dave (a participant in four-party protocols), Eve (an eavesdropper), Mallory (a malicious active attacker), Trent (a trusted arbitrator), Walter (a warden), Peggy (a prover), Victor (a verifier), Sam (a trusted server - Uncle Sam) and Charlie (a challenger/opponent).

Fred & Barney

After the characters in the cartoon series The Flintstones.

xyzzy

xyzzy is from the Colossal Cave Adventure.

42

The number 42 is often a common initializer for integer variables, and acts as in the same vein as a "metasyntactic value". It is taken from Douglas Adams The Hitchhiker's Guide to the Galaxy. It is The Answer to Life, the Universe, and Everything.

Other examples

quux, mum, thud, beekeeper, hoge, corge, grault, garply, waldo, plugh, kalaa, puppu.

Algebra

This is similar to algebraic variables which are usually x, y, and z for unknown variables and a, b, and c for constants.


An earlier version of the above paraphrased a Jargon File article here.


[Main Page]
Main Page
Recent changes
Random page
Current events

Edit this page
Discuss this page
Page history
What links here
Related changes

Special pages
Contact us
Donations