Metasyntactic variable

Share on Facebook Share on Twitter Email
Computer Desktop Encyclopedia:

metasyntactic variable

Top

A name given by a programmer to a file or function that is a temporary example. Names such as "foo," "thud," "blarg," "bongo," "foogle" and many others are used. If a file with such a name is later found, it is considered temporary and can be deleted. See variable and foo.

Download Computer Desktop Encyclopedia to your PC, iPhone or Android.

Top

A name used in examples and understood 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. To avoid confusion, hackers never (well, hardly ever) use ‘foo’ or other words like it as permanent names for anything. In filenames, a common convention is that any filename beginning with a metasyntactic-variable name is a scratch file that may be deleted at any time.

Metasyntactic variables are so called because (1) they are variables in the metalanguage used to talk about programs etc; (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. To some extent, the list of one's preferred metasyntactic variables is a cultural signature. They occur both in series (used for related groups of variables or objects) and as singletons. Here are a few common signatures:

foo, bar, baz, quux, quuux, quuuux...: MIT/Stanford usage, now found everywhere (thanks largely to early versions of this lexicon!). At MIT (but not at Stanford), baz dropped out of use for a while in the 1970s and '80s. A common recent mutation of this sequence inserts quxbefore quux.
bazola, ztesch:Stanford (from mid-'70s on).
foo, bar, thud, grunt:This series was popular at CMU. Other CMU-associated variables include gorp.
foo, bar, bletch: Waterloo University. We are informed that the CS club at Waterloo formerly had a sign on its door reading “Ye Olde Foo Bar and Grill”; this led to an attempt to establish “grill” as the third metasyntactic variable, but it never caught on.
foo, bar, fum:This series is reported to be common at XEROX PARC.
fred, jim, sheila, barney:See the entry for fred. These tend to be Britishisms.
flarp:Popular at Rutgers University and among GOSMACS hackers.
zxc, spqr, wombat:Cambridge University (England).
shmeBerkeley, GeoWorks, Ingres. Pronounced /shme/ with a short /e/.
foo, bar, baz, bongoYale, late 1970s.
spam, eggsPython programmers.
snorkBrown University, early 1970s.
foo, bar, zot Helsinki University of Technology, Finland.
blarg, wibbleNew Zealand.
toto, titi, tata, tutuFrance.
pippo, pluto, paperinoItaly. Pippo /pee´po/ and Paperino /pa·per·ee'·no/ are the Italian names for Goofy and Donald Duck.
aap, noot, miesThe Netherlands. These are the first words a child used to learn to spell on a Dutch spelling board.
oogle, foogle, boogle; zork, gork, borkThese two series (which may be continued with other initial consonents) are reportedly common in England, and said to go back to Lewis Carroll.

Of all these, only foo and bar are universal (and baz nearly so). The compounds foobar and foobaz also enjoy very wide currency. Some jargon terms are also used as metasyntactic names; barf and mumble, for example. See also Commonwealth Hackish for discussion of numerous metasyntactic variables found in Great Britain and the Commonwealth.


Wikipedia on Answers.com:

Metasyntactic variable

Top

A metasyntactic variable, in computer science, is a placeholder name or an alias term commonly used to denote an arbitrary thing, or an arbitrary member of a class of things under discussion. The use of a metasyntactic variable is helpful in freeing a programmer from creating a logically named variable, which is often useful when creating or teaching examples of an algorithm. The word foo is the principal example.[1]

The term "metasyntactic variable" is primarily found in informal literature. It is sometimes also used as a synonym for metavariable.

Any symbol or word which does not violate the rules of the language can be used as a metasyntactic variable, but nonsense words are commonly used. The same concept is employed in other fields where it is expressed by terms such as schematic variable (see logical form).

By mathematical analogy: A metasyntactic variable is a word that is a variable for other words, just as in algebra letters are used as variables for numbers.[1]

Contents

Construction

  • meta- means providing information about, or transcending,
  • syntax denotes the grammatical arrangement of words or the grammatical rules of a programming language, and
  • a variable is something that can assume a value, or something likely to vary.

So metasyntactic variable denotes a word that "transcends grammar and can assume a value" or one that is "more comprehensive than suggested by its grammatical arrangement and is likely to vary". It may also denote a word that provides information about the grammatical arrangement of words by being able to assume a value that is expected to vary.

Words commonly used as metasyntactic variables

English

A "standard list of metasyntactic variables used in syntax examples" often used in the United States is: foo, bar, baz, qux, quux, corge, grault, garply, waldo, fred, plugh, xyzzy, thud.[1] The word foo occurs in over 330 RFCs and bar occurs in over 290.[2] Wibble, wobble, wubble, Fred and flob are often used in the UK.[3]

Due to English being the foundation-language, or lingua franca, of most computer programming languages these variables are also commonly seen even in programs and examples of programs written for other spoken-language audiences.

French

In French, the words toto, titi, tata and tutu are commonly used.

Japanese

In Japanese, the words hoge and page are commonly used, with other common words and variants being piyo, fuga, hogera, and hogehoge.[4] Note that -ra is a pluralizing ending in Japanese, and reduplication is also used for pluralizing. The origin of hoge as a metasyntactic variable is not known, but it is believed to date to the early 1980s.[4]

Israeli Hebrew

In Hebrew, the words chupchick and stam are commonly used.

Italian

In Italian, the word pippo is commonly used. Strangely enough, besides being an abbreviation of the first names Giuseppe (Joseph) and Filippo (Philip), pippo is the Italian name of the Disney character Goofy, but it is probably used just because of its sound which is quite strange; moreover, this name is very fast to be typed with the computer keyboard, as it involves three near keys (P, I and O). Sometimes the words pluto and paperino (Italian name of Donald Duck) can be hence used as additional terms.

Portuguese

In Portuguese, the words fulano, cicrano and beltrano are commonly used. These words have the constraint that they can only be used to refer to people.

Spanish

In Spanish, the words fulano, mengano and zutano are commonly used, often followed by de tal mocking a lastname in Spanish form (i.e. Fulano de Tal). These words have the constraint that they can only be used to refer to people, as in the case with Portuguese. Also, when referring to an example of some person performing a certain action, Perico de los Palotes can also be used as a placeholder for a real name. In place of people or objects (including numbers, etc.) the usual X, Y, Z are used (i.e. Person X, Quantity X).

Programming language examples

C

In the following example of the C programming language the function name foo and the variable name bar are both metasyntactic variables. Lines beginning with /* and ending with */ are comments.

/* The function named foo */
int foo(void)
{
   /* Declare the variable bar and set the value to 1 */
   int bar = 1;
 
   return bar;
}

Python

Spam, ham, and eggs are the principal metasyntactic variables used in the Python programming language.[5] This is a reference to the famous comedy sketch Spam by Monty Python, the eponym of the language.[6] In the following example spam, ham, and eggs are metasyntactic variables and lines beginning with # are comments.

# Define a function named spam
def spam():
 
    # define the variable ham
    ham = "Hello World!"
 
    #define the variable eggs
    eggs = 1
 
    return

Ruby

In the following example the foo, bar, and baz are metasyntactic variables and lines beginning with # are comments.

# Declare the variable foo and set equal to 1
foo = 1
 
# Declare the variable bar and set equal to 2
bar = 2
 
# Declare the method (function) named baz, which prints the text 'Hello world'
def baz
   puts 'Hello world'
end

See also

References

  1. ^ a b c RFC 3092 (rfc3092) - Etymology of "Foo"
  2. ^ RFC-Editor.org
  3. ^ wibble. (n.d.). Jargon File 4.4.7. Retrieved February 23, 2010, from [1]
  4. ^ a b メタ構文変数 (Japanese)
  5. ^ Python Tutorial
  6. ^ General Python FAQ

External links


Post a question - any question - to the WikiAnswers community:

Copyrights:

Mentioned in

garply (computer jargon)
gorp (computer jargon)
fum (computer jargon)
bar (computer jargon)
barney (computer jargon)