Metasyntactic variable

From Academic Kids

A metasyntactic variable is a placeholder name, or a kind of alias term, commonly used to denote the subject matter under discussion, or a random member of a class of things under discussion. The term originates from computer programming and other technical contexts, and is commonly used in examples by hackers and programmers. The use of a metasyntactic variable is helpful in freeing a programmer from creating a logically named variable, although the invented term may also become sufficiently popular and enter the language as a neologism. The word foo is the canonical example.

The phenomenon is similar to the use in algebra of x, y and z for unknown variables, and a, b and c for unknown constants.

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 'cool': the term is an example of computer jargon.



Nonsense words

Foo, Bar and Baz

Foo is the first metasyntactic variable, commonly used to represent an as-yet-unspecified term, value, process, function, destination or event but seldom a person (see Ned Baker, below). 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/fouled up beyond all recognition/repair, although the Jargon File makes a reasonably good case [1] ( that foo predates fubar. 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 fighter for more foo etymology, as well as RFC 3092 (

"Kung fu" means skill from effort. "Kung foo" means skill from bad-ass programming powers. This is actually used (though misspelled) in the movie The Core.

Bar, the canonical second metasyntactic variable, typically follows foo.

Baz, the canonical third metasyntactic variable, is commonly used after foo and bar.

Foo, bar, and baz are often compounded together to make such words as foobar, barbaz, and foobaz.


Quux is the canonical fourth metasyntactic variable, commonly used after baz. However, more recently Qux has become more common as the fourth variable, displacing Quux as the fifth. A probable reason for this is that Quux is often followed by the series Quuux, Quuuux, Quuuuux etc. and Qux fits this pattern perfectly.


Bat is used by some programmers as an alternative to quux.


The word xyzzy is the "magic word" from the Colossal Cave Adventure, and therefore is often used as a metasyntactic variable, especially by old-school hackers.


Infrequently used in various environments such as Berkeley, GeoWorks, Ingres, Quovadx. Pronounced /shmeh/ with a short /e/.

English words

Spam and Eggs

Spam and eggs are the canonical metasyntactic variables used in the Python programming language. This is a reference to a famous comedy sketch by Monty Python, after which the language is named.

Needle and Haystack

Needle and haystack are commonly used in computer programming to describe the syntax of functions that involve a search parameter and a search target, such as searching a substring within a string; with these two words, derived from the idiom "to find a needle in a haystack", it is clearer where the substring to search for goes, and where the string to search in goes. This can be seen, for instance, in the documentation for some functions in the computer language PHP, see [2] ( for an example.

Other examples

Other words used as metasyntactic variables include: beekeeper, blah, blarg, corge, dothestuff, garply, glarb, grault, hoge, kalaa, mum, plugh, puppu, sub, temp, test, thud, var, waldo, momo.

Plugh, like xyzzy, is a "magic word" from the Colossal Cave Adventure.



The number 23 is also commonly used as an integer example—particularly when the connotations associated with 42 are undesirable.


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


The number 47 is sometimes used instead of 42 above, and is used mainly by members of the 47 society, or New Trek fans.


69 is often used as an example number. Popular among hackers as an addition to metasyntactic variables (foo69, bar69), also used in all sorts of hacks. It is a largest number whose factorial can be calculated by a pocket calculator limited to standard scientific notation with a 2 digit exponent. 69 is also popular because of its reference to a sexual position.


0815 (named after the repetive and boring MG 08/15-training) is used in German as either a random number or to reflect something normal or boring.


Stands for Leet, in Leetspeak, being, thus, commonly used.


4711 is most commonly used in German computer speak as a random member of a set. It is a brand of Eau de Cologne, originally named after the number of the manufacturer's house in Cologne.


6858 is the self-destruct code for the Star Generator in the game Space Quest. At least one programmer has been known to use this as a meta-syntactic or magic number.

Names of people

J. Random and Ned Baker

J. Random and Ned Baker are the names of archetypal users; compare to "The Joneses". J. Random Hacker and J. Random User are also common.

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
  • Ellen - a participant in five- and six-party protocols
  • Frank - a participant in six-party protocols, and so on
  • Eve or Oscar - an (evil) eavesdropper
  • Mallory or Mallet - a malicious active attacker
  • Trent - a trusted arbitrator
  • Walter - a warden
  • Peggy - a prover
  • Victor - a verifier
  • Sam - a trusted server (Uncle Sam)
  • Charlie - a challenger or opponent
  • Trudy - an intruder or malicious entity

Bob, Alice and Carol may have come from the 1969 movie Bob & Carol & Ted & Alice, or from the fact that they are common English names starting with A, B and C, the first letters of the alphabet. Dave, Ellen, and Frank are the next three letters. Some people continue this pattern, using Greg or another similar term for the seventh participant, and so on.

Fred and Barney

After the characters in the cartoon series The Flintstones. The most famous use of these is the example code in Learning Perl. Fred is also known to have been used simply because the keys are close together on the QWERTY keyboard.

Other names

Sometimes placeholders from other contexts will be used: John Doe, Jane Roe, Richard Roe, A. N. Other, John Q. Public, and Bloggs or Joe Bloggs. Other nonsense names come from swapping initials, e.g. J. Pennings.

Place Names

Smallville and Metropolis

Smallville and Metropolis are fictional places from the Superman series of comic books. These are used to contrast urban and rural characteristics.

Anywhere and Nowhere

Anywhere, USA connotes genericness. Nowhere sometimes suggests that the entry is invalid.

Middle of Nowhere

Unlike Nowhere, this metasyntactic variable indicates extreme remoteness and suggests contempt.

Podunk University

This term is sometimes a placeholder for a generic university.


Test cards have been used as standard images and so has Lenna.

Other languages

Other languages sometimes have their own metasyntactic variables. For example:

  • Jia, Yi, Bing, Ding - from Chinese
  • flaf, giraf, boing - from Danish
  • Aap, Noot, Mies - from Dutch
  • pippo, pluto, paperino (Italian names of the Disney characters Goofy, Pluto and Donald Duck) - from Italian
  • Maria Bernasconi - from Italian in Switzerland
  • toto, tata, titi - from French
  • koko, lala, malakia - from Greek
  • hoge, hogehoge, moge, huga, piyo - from Japanese
  • peh, meh, shmeh - from Yiddish
  • bla, nha, la, patati, patata - from Portuguese
  • huu, haa - from Finnish
  • hahaa, hihii, hohoo - also from Finnish
  • kalatehas (fish factory) - from Estonian
  • muh, bla, blubb, schlurps, schnurz, Lieschen Mueller - from German
  • bubu, mumu, zeze - from Romanian
  • brol, prout - from French in Belgium
  • filan, hede, hd, zıvır, ıvır - from Turkish
  • fulano, mengano, zutano, pepe (Joe), pp (phonetic equivalent), cosa (in spanish, "cosa" can be anything, but usually refers to some physical object) - from Spanish
  • Ploni (פלוני) as a person's name; Reuven (ראובן) and Shim'on (שמעון) as two persons (after Jacob's Sons)- from Hebrew
  • Kuppuswamy, Ramaswamy - from Tamil
  • Gipsz Jakab - from Hungarian

See also

External links

fr:Variable mtasyntaxique he:משתנה מטה תחבירי ja:メタ構文変数 pl:Zmienna metasyntaktyczna ru:Мета-переменная fi:Foo


Academic Kids Menu

  • Art and Cultures
    • Art (
    • Architecture (
    • Cultures (
    • Music (
    • Musical Instruments (
  • Biographies (
  • Clipart (
  • Geography (
    • Countries of the World (
    • Maps (
    • Flags (
    • Continents (
  • History (
    • Ancient Civilizations (
    • Industrial Revolution (
    • Middle Ages (
    • Prehistory (
    • Renaissance (
    • Timelines (
    • United States (
    • Wars (
    • World History (
  • Human Body (
  • Mathematics (
  • Reference (
  • Science (
    • Animals (
    • Aviation (
    • Dinosaurs (
    • Earth (
    • Inventions (
    • Physical Science (
    • Plants (
    • Scientists (
  • Social Studies (
    • Anthropology (
    • Economics (
    • Government (
    • Religion (
    • Holidays (
  • Space and Astronomy
    • Solar System (
    • Planets (
  • Sports (
  • Timelines (
  • Weather (
  • US States (


  • Home Page (
  • Contact Us (

  • Clip Art (
Personal tools