HOME

TheInfoList



OR:

A metasyntactic variable is a specific word or set of words identified as a
placeholder Placeholder may refer to: Language * Placeholder name, a term or terms referring to something or somebody whose name is not known or, in that particular context, is not significant or relevant. * Filler text, text generated to fill space or provi ...
in
computer science Computer science is the study of computation, automation, and information. Computer science spans theoretical disciplines (such as algorithms, theory of computation, information theory, and automation) to Applied science, practical discipli ...
and specifically
computer programming Computer programming is the process of performing a particular computation (or more generally, accomplishing a specific computing result), usually by designing and building an executable computer program. Programming involves tasks such as ana ...
. These words are commonly found in
source code In computing, source code, or simply code, is any collection of code, with or without comments, written using a human-readable programming language, usually as plain text. The source code of a program is specially designed to facilitate the wo ...
and are intended to be modified or substituted before real-world usage. The words foo and bar are good examples as they are used in over 330
Internet Engineering Task Force The Internet Engineering Task Force (IETF) is a standards organization for the Internet and is responsible for the technical standards that make up the Internet protocol suite (TCP/IP). It has no formal membership roster or requirements and a ...
Requests for Comments A Request for Comments (RFC) is a publication in a series from the principal technical development and standards-setting bodies for the Internet, most prominently the Internet Engineering Task Force (IETF). An RFC is authored by individuals or g ...
, the documents which define foundational internet technologies like
HTTP The Hypertext Transfer Protocol (HTTP) is an application layer protocol in the Internet protocol suite model for distributed, collaborative, hypermedia information systems. HTTP is the foundation of data communication for the World Wide Web, ...
(web),
TCP/IP The Internet protocol suite, commonly known as TCP/IP, is a framework for organizing the set of communication protocols used in the Internet and similar computer networks according to functional criteria. The foundational protocols in the suit ...
, and
email Electronic mail (email or e-mail) is a method of exchanging messages ("mail") between people using electronic devices. Email was thus conceived as the electronic ( digital) version of, or counterpart to, mail, at a time when "mail" meant ...
protocol Protocol may refer to: Sociology and politics * Protocol (politics), a formal agreement between nation states * Protocol (diplomacy), the etiquette of diplomacy and affairs of state * Etiquette, a code of personal behavior Science and technolog ...
s. By mathematical
analogy Analogy (from Greek ''analogia'', "proportion", from ''ana-'' "upon, according to" lso "against", "anew"+ ''logos'' "ratio" lso "word, speech, reckoning" is a cognitive process of transferring information or meaning from a particular subject ( ...
, a metasyntactic variable is a word that is a
variable Variable may refer to: * Variable (computer science), a symbolic name associated with a value and whose associated value may be changed * Variable (mathematics), a symbol that represents a quantity in a mathematical expression, as used in many ...
for other words, just as in
algebra Algebra () is one of the broad areas of mathematics. Roughly speaking, algebra is the study of mathematical symbols and the rules for manipulating these symbols in formulas; it is a unifying thread of almost all of mathematics. Elementary a ...
letters are used as variables for
number A number is a mathematical object used to count, measure, and label. The original examples are the natural numbers 1, 2, 3, 4, and so forth. Numbers can be represented in language with number words. More universally, individual numbers c ...
s. Metasyntactic variables are used to name entities such as variables, functions, and commands whose exact identity is unimportant and serve only to demonstrate a concept, which is useful for teaching programming.


Common metasyntactic variables

Due to English being the foundation-language, or
lingua franca A lingua franca (; ; for plurals see ), also known as a bridge language, common language, trade language, auxiliary language, vehicular language, or link language, is a language systematically used to make communication possible between groups ...
, of most computer programming languages, these variables are commonly seen even in programs and examples of programs written for other spoken-language audiences. The typical names may depend however on the subculture that has developed around a given
programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
.


General usage

Metasyntactic variables used commonly across all programming languages include ''
foobar The terms foobar (), foo, bar, baz, and others are used as metasyntactic variables and placeholder names in computer programming or computer-related documentation. - Etymology of "Foo" They have been used to name entities such as variables, fu ...
'', ''foo'', ''bar'', ''baz'', ', ', ', ', ', ', ', ', '' '', ', and ''thud''; several of these words are references to the game ''
Colossal Cave Adventure ''Colossal Cave Adventure'' (also known as ''Adventure'' or ''ADVENT'') is a text-based adventure game, released in 1976 by developer Will Crowther for the PDP-10 mainframe computer. It was expanded upon in 1977 by Don Woods. In the game, the pl ...
''. A complete reference can be found in a
MIT Press The MIT Press is a university press affiliated with the Massachusetts Institute of Technology (MIT) in Cambridge, Massachusetts (United States). It was established in 1962. History The MIT Press traces its origins back to 1926 when MIT publish ...
book titled ''
The Hacker's Dictionary The Jargon File is a glossary and usage dictionary of slang used by computer programmers. The original Jargon File was a collection of terms from technical cultures such as the MIT AI Lab, the Stanford AI Lab (SAIL) and others of the old ARPANET ...
''.


Japanese

In Japanese, the words (ほげ) and ''fuga'' (ふが) are commonly used, with other common words and variants being piyo (ぴよ), (ほげら), and (ほげほげ). メタ構文変数 The origin of as a metasyntactic variable is not known, but it is believed to date to the early 1980s.


French

In France, the word ''toto'' is widely used, with variants ''tata'', ''titi'', ''tutu'' as related placeholders. One commonly-raised source for the use of ''toto'' is a reference to the stock character used to tell jokes with
Tête à Toto The tête à Toto is a French typographical design and children's game, well known to French schoolchildren. It consists of the equation "0+0=0", written with the first two "0"s for eyes, the "+" for a nose, the "=" for a mouth, and the final "0" ...
.


Usage examples


C

In the following example the function name ''foo'' and the variable name ''bar'' are both metasyntactic variables. Lines beginning with // are comments. // The function named foo int foo(void)


C++

Function prototypes with examples of different argument passing mechanisms: void Foo(Fruit bar); void Foo(Fruit* bar); void Foo(const Fruit& bar); Example showing the
function overloading In some programming languages, function overloading or method overloading is the ability to create multiple functions of the same name with different implementations. Calls to an overloaded function will run a specific implementation of that f ...
capabilities of the C++ language void Foo(int bar); void Foo(int bar, int baz); void Foo(int bar, int baz, int qux);


Python

Spam Spam may refer to: * Spam (food), a canned pork meat product * Spamming, unsolicited or undesired electronic messages ** Email spam, unsolicited, undesired, or illegal email messages ** Messaging spam, spam targeting users of instant messaging ( ...
,
ham Ham is pork from a leg cut of pork, cut that has been food preservation, preserved by wet or dry Curing (food preservation), curing, with or without smoking (cooking), smoking."Bacon: Bacon and Ham Curing" in ''Chambers's Encyclopædia''. Lo ...
, and
eggs Humans and human ancestors have scavenged and eaten animal eggs for millions of years. Humans in Southeast Asia had domesticated chickens and harvested their eggs for food by 1,500 BCE. The most widely consumed eggs are those of fowl, especial ...
are the principal metasyntactic variables used in the
Python programming language Python is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation. Python is dynamically-typed and garbage-collected. It supports multiple programming p ...
. This is a reference to the famous comedy sketch, "
Spam Spam may refer to: * Spam (food), a canned pork meat product * Spamming, unsolicited or undesired electronic messages ** Email spam, unsolicited, undesired, or illegal email messages ** Messaging spam, spam targeting users of instant messaging ( ...
", by
Monty Python Monty Python (also collectively known as the Pythons) were a British comedy troupe who created the sketch comedy television show '' Monty Python's Flying Circus'', which first aired on the BBC in 1969. Forty-five episodes were made over four ...
, the eponym of the language. 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


IETF Requests for Comments

Both the
IETF The Internet Engineering Task Force (IETF) is a standards organization for the Internet and is responsible for the technical standards that make up the Internet protocol suite (TCP/IP). It has no formal membership roster or requirements and a ...
RFC RFC may refer to: Computing * Request for Comments, a memorandum on Internet standards * Request for change, change management * Remote Function Call, in SAP computer systems * Rhye's and Fall of Civilization, a modification for Sid Meier's Civ ...
s and
computer programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming l ...
s are rendered in
plain text In computing, plain text is a loose term for data (e.g. file contents) that represent only characters of readable material but not its graphical representation nor other objects (floating-point numbers, images, etc.). It may also include a limit ...
, making it necessary to distinguish metasyntactic variables by a naming convention, since it would not be obvious from context. Here is an example from the official
IETF The Internet Engineering Task Force (IETF) is a standards organization for the Internet and is responsible for the technical standards that make up the Internet protocol suite (TCP/IP). It has no formal membership roster or requirements and a ...
document explaining the
e-mail Electronic mail (email or e-mail) is a method of exchanging messages ("mail") between people using electronic devices. Email was thus conceived as the electronic ( digital) version of, or counterpart to, mail, at a time when "mail" meant ...
protocols (from RFC 772 - cited in RFC 3092): All is well; now the recipients can be specified. S: MRCP TO: R: 200 OK S: MRCP TO: R: 553 No such user here S: MRCP TO: R: 200 OK S: MRCP TO:<@Y,@X,fubar@Z> R: 200 OK Note that the failure of "Raboof" has no effect on the storage of mail for "Foo", "bar" or the mail to be forwarded to "fubar@Z" through host "X". (The documentation for texinfo emphasizes the distinction between metavariables and mere variables used in a programming language being documented in some texinfo file as: "Use the @var command to indicate metasyntactic variables. A metasyntactic variable is something that stands for another piece of text. For example, you should use a metasyntactic variable in the documentation of a function to describe the arguments that are passed to that function. Do not use @var for the names of particular variables in programming languages. These are specific names from a program, so @code is correct for them.") Another point reflected in the above example is the convention that a metavariable is to be uniformly substituted with the same instance in all its appearances in a given schema. This is in contrast with
nonterminal In computer science, terminal and nonterminal symbols are the lexical elements used in specifying the production rules constituting a formal grammar. ''Terminal symbols'' are the elementary symbols of the language defined by a formal grammar. ...
symbols in
formal grammars In formal language theory, a grammar (when the context is not given, often called a formal grammar for clarity) describes how to form strings from a language's alphabet that are valid according to the language's syntax. A grammar does not describe ...
where the nonterminals on the right of a production can be substituted by different instances.


Example data


SQL

It is common to use the name
ACME Acme is Ancient Greek (ακμή; English transliteration: ''akmē'') for "the peak", "zenith" or "prime". It may refer to: Arts and entertainment * ''Acme'' (album), an album by the Jon Spencer Blues Explosion * Acme and Septimius, a fictional ...
in example SQL
Database In computing, a database is an organized collection of data stored and accessed electronically. Small databases can be stored on a file system, while large databases are hosted on computer clusters or cloud storage. The design of databases sp ...
s and as placeholder company-name for the purpose of teaching. The term 'ACME Database' is commonly used to mean a training or example-only set of database data used solely for training or testing. ACME is also commonly used in documentation which shows SQL usage examples, a common practice with in many educational texts as well as technical documentation from companies such as
Microsoft Microsoft Corporation is an American multinational technology corporation producing computer software, consumer electronics, personal computers, and related services headquartered at the Microsoft Redmond campus located in Redmond, Washing ...
and
Oracle An oracle is a person or agency considered to provide wise and insightful counsel or prophetic predictions, most notably including precognition of the future, inspired by deities. As such, it is a form of divination. Description The word '' ...
.


See also

* Metavariable (logic) * xyzzy *
Alice and Bob Alice and Bob are fictional characters commonly used as placeholders in discussions about cryptographic systems and protocols, and in other science and engineering literature where there are several participants in a thought experiment. The A ...
*
John Doe John Doe (male) and Jane Doe (female) are multiple-use placeholder names that are used when the true name of a person is unknown or is being intentionally concealed. In the context of law enforcement in the United States, such names are often ...
*
Fnord "Fnord" () is a word coined in 1965 by Kerry Thornley and Greg Hill in the Discordian religious text '' Principia Discordia''. It entered the popular culture after appearing in '' The Illuminatus! Trilogy'' (1975) of satirical and parody consp ...
*
Free variables and bound variables In mathematics, and in other disciplines involving formal languages, including mathematical logic and computer science, a free variable is a notation (symbol) that specifies places in an expression where substitution may take place and is not ...
*
Gadget A gadget is a mechanical device or any ingenious article. Gadgets are sometimes referred to as '' gizmos''. History The etymology of the word is disputed. The word first appears as reference to an 18th-century tool in glassmaking that was develo ...
*''
Lorem ipsum In publishing and graphic design, ''Lorem ipsum'' is a placeholder text commonly used to demonstrate the visual form of a document or a typeface without relying on meaningful content. ''Lorem ipsum'' may be used as a placeholder before final c ...
'' *
Nonce word A nonce word (also called an occasionalism) is a lexeme created for a single occasion to solve an immediate problem of communication.''The Cambridge Encyclopedia of The English Language''. Ed. David Crystal. Cambridge: Cambridge University Press, ...
*
Placeholder name Placeholder names are words that can refer to things or people whose names do not exist, are temporarily forgotten, are not relevant to the salient point at hand, are to avoid stigmatization, are unknowable/unpredictable in the context in wh ...
* Widget *
Smurf ''The Smurfs'' (french: Les Schtroumpfs; nl, De Smurfen) is a Belgian comic franchise centered on a fictional colony of small, blue, humanoid creatures who live in mushroom-shaped houses in the forest. ''The Smurfs'' was first created and int ...


References

{{Reflist


External links


Definition of ''metasyntactic variable'', with examples.
used in ''
Commonwealth A commonwealth is a traditional English term for a political community founded for the common good. Historically, it has been synonymous with "republic". The noun "commonwealth", meaning "public welfare, general good or advantage", dates from the ...
Hackish'', such as ''wombat''.
Variable "foo" and Other Programming Oddities
Placeholder names Metalogic Variable (computer science) Syntax (logic)