Share on Facebook Share on Twitter Email
Answers.com

Metasyntactic variable

 
Computer Desktop Encyclopedia: metasyntactic variable

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 iPhone/iTouch

Search unanswered questions...
Enter a question here...
Search: All sources Community Q&A Reference topics
Hacker Slang: metasyntactic variable
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: Metasyntactic variable
Top

In logic, mathematics and computer science, a metasyntactic variable (pronounced /ˌmɛtəsɪnˈtæktɪk ˈvɛəriəbl/) (also metalinguistic variable) is a symbol or set of symbols in a metalanguage which stands for a symbol or set of symbols in some object language. For instance, in the sentence:

Let A and B be two arbitrary formulas of a formal language \mathcal{L}.

The symbols A and B are not symbols of the object language \mathcal{L}, they are metasyntactic variables in the metalanguage (in this case, English) which is talking about the object language \mathcal{L}.

In computer science, programmers use metasyntactic variables to describe a placeholder name or an alias term commonly used to denote the subject matter under discussion 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. The word foo is the principal example.[1]

In Terry Pratchett's book Men at Arms, the dog Gaspode says, "Clothing has never been what you might call a thingy of dog wossname.", and then adds, "Two metasyntactic variables there. Sorry."

Any symbol or word 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).

Contents

Etymology

  • 'Meta' means providing information about, or transcending.
  • 'Syntax' means the grammatical arrangement of words or the grammatical rules of a programming language.
  • 'Variable' means something that can assume a value, or something likely to vary.

So we have a word that

transcends grammar and can assume a value

or one that

is more comprehensive than grammatical arrangement and is likely to vary.

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]

Words commonly used as metasyntactic variables

A "standard list of metasyntactic variables used in syntax examples" 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]

Foo is used in one section of a tutorial on the C programming language by Brian W. Kernighan. Here, he illustrates the use of the extern declaration:[3]

Second, at the beginning of any file
that contains functions needing a variable whose definition is in some other file,
put in an extern declaration, outside of any function:

       extern  int     foo;

       f1( ) { ... }
          etc.

In Python

Spam, ham, and eggs are the principal[citation needed] metasyntactic variables used in the Python programming language.[4] This is a reference to the famous comedy sketch, Spam, by Monty Python, the namesake of the language.[5] In this extract from the Python tutorial showing the use of comments,[6] SPAM and STRING are metasyntactic variables.

Some examples:

# this is the first comment
SPAM = 1                 # and this is the second comment
                         # ... and now a third!
STRING = "# This is not a comment."

Wibble, wobble, wubble and flob are often used in the UK[7]

References

See also

External links


 
 

 

Copyrights:

Computer Desktop Encyclopedia. THIS COPYRIGHTED DEFINITION IS FOR PERSONAL USE ONLY.
All other reproduction is strictly prohibited without permission from the publisher.
© 1981-2009 Computer Language Company Inc.  All rights reserved.  Read more
Hacker Slang. The Jargon File. Copyright © 2007.  Read more
Wikipedia. This article is licensed under the Creative Commons Attribution/Share-Alike License. It uses material from the Wikipedia article "Metasyntactic variable" Read more

 

Mentioned in

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