HOME

TheInfoList



OR:

A metasyntactic variable is a specific word or set of words identified as a placeholder in
computer science Computer science is the study of computation, information, and automation. Computer science spans Theoretical computer science, theoretical disciplines (such as algorithms, theory of computation, and information theory) to Applied science, ...
and specifically
computer programming Computer programming or coding is the composition of sequences of instructions, called computer program, programs, that computers can follow to perform tasks. It involves designing and implementing algorithms, step-by-step specifications of proc ...
. These words are commonly found in
source code In computing, source code, or simply code or source, is a plain text computer program written in a programming language. A programmer writes the human readable source code to control the behavior of a computer. Since a computer, at base, only ...
and are intended to be modified or substituted before real-world usage. For example, ''foo'' and ''bar'' are used in over 330
Internet Engineering Task Force The Internet Engineering Task Force (IETF) is a standards organization for the Internet standard, Internet and is responsible for the technical standards that make up the Internet protocol suite (TCP/IP). It has no formal membership roster ...
Requests for Comments, the documents which define foundational internet technologies like
HTTP HTTP (Hypertext Transfer Protocol) 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, wher ...
(web),
TCP/IP The Internet protocol suite, commonly known as TCP/IP, is a framework for organizing the communication protocols used in the Internet and similar computer networks according to functional criteria. The foundational protocols in the suite are ...
, and
email Electronic mail (usually shortened to email; alternatively hyphenated e-mail) is a method of transmitting and receiving Digital media, digital messages using electronics, electronic devices over a computer network. It was conceived in the ...
protocols. By mathematical analogy, a metasyntactic variable is a word that is a variable for other words, just as in
algebra Algebra is a branch of mathematics that deals with abstract systems, known as algebraic structures, and the manipulation of expressions within those systems. It is a generalization of arithmetic that introduces variables and algebraic ope ...
letters are used as variables for
number A number is a mathematical object used to count, measure, and label. The most basic 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 can ...
s. Metasyntactic variables are used to name entities such as variables, functions, and
command Command may refer to: Computing * Command (computing), a statement in a computer language * command (Unix), a Unix command * COMMAND.COM, the default operating system shell and command-line interpreter for DOS * Command key, a modifier key on A ...
s whose exact identity is unimportant and serve only to demonstrate a concept, which is useful for teaching programming.


Common metasyntactic variables

Since English is the foundation language or
lingua franca A lingua franca (; ; for plurals see ), also known as a bridge language, common language, trade language, auxiliary language, link language or language of wider communication (LWC), is a Natural language, language systematically used to make co ...
of most computer programming languages, variables that originate in English are commonly seen even in programs and examples of programs written for other spoken-language audiences. The variables used in a particular context may depend on subcultures that develop around
programming language A programming language is a system of notation for writing computer programs. Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
s.


General usage

Metasyntactic variables used commonly across all programming languages include ''
foobar The terms foobar (), foo, bar, baz, qux, quux, 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 v ...
'', ''foo'', ''bar'', ''baz'', ', ', ', ', ', ', ', ', '' '', and ''thud''. Two of these words, ''plugh'' and ''xyzzy'', are taken from the game '' Colossal Cave Adventure''. A fuller reference can be found in '' The Hacker's Dictionary'' from
MIT Press The MIT Press is the university press of the Massachusetts Institute of Technology (MIT), a private research university in Cambridge, Massachusetts. The MIT Press publishes a number of academic journals and has been a pioneer in the Open Ac ...
.


Japanese

In Japanese, the words (ほげ) and (ふが) are commonly used, with other common words and variants being (ぴよ), (ほげら), 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.


Turkish

In Turkey, the words ''hede'' and ''hödö'' (usually spelt ''hodo'' due to
ASCII ASCII ( ), an acronym for American Standard Code for Information Interchange, is a character encoding standard for representing a particular set of 95 (English language focused) printable character, printable and 33 control character, control c ...
-only naming constraints of programming languages) are well-known metasyntactic variables that stem from popular humorous cartoon magazines of the 90's like LeMan. The words do not mean anything, and are used for precisely that reason. The terms were popularized more widely by the actor and stand-up comedian Cem Yılmaz in the late 90's and early 2000's.


Italian

In Italian software programming culture, it is common to encounter names of Walt Disney characters (as found in the Italian versions of the shows) being used as variables. These names often appear in pseudo-code, are referenced in software engineering classes, and are commonly employed when explaining algorithms to colleagues. Among the most frequently used are "pippo" (Goofy), "pluto," and "paperino" (Donald Duck).


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 most often refers to: * Spam (food), a consumer brand product of canned processed pork of the Hormel Foods Corporation * Spamming, unsolicited or undesired electronic messages ** Email spam, unsolicited, undesired, or illegal email messages ...
, ham, and eggs 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 type-checked and garbage-collected. It supports multiple prog ...
. This is a reference to the famous comedy sketch, "
Spam Spam most often refers to: * Spam (food), a consumer brand product of canned processed pork of the Hormel Foods Corporation * Spamming, unsolicited or undesired electronic messages ** Email spam, unsolicited, undesired, or illegal email messages ...
", by
Monty Python Monty Python, also known as the Pythons, were a British comedy troupe formed in 1969 consisting of Graham Chapman, John Cleese, Terry Gilliam, Eric Idle, Terry Jones and Michael Palin. The group came to prominence for the sketch comedy ser ...
, 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 standard, Internet and is responsible for the technical standards that make up the Internet protocol suite (TCP/IP). It has no formal membership roster ...
RFCs and
computer programming language A programming language is a system of notation for writing computer programs. Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
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 lim ...
, 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 standard, Internet and is responsible for the technical standards that make up the Internet protocol suite (TCP/IP). It has no formal membership roster ...
document explaining the
e-mail Electronic mail (usually shortened to email; alternatively hyphenated e-mail) is a method of transmitting and receiving Digital media, digital messages using electronics, electronic devices over a computer network. It was conceived in the ...
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 symbols in
formal grammars A formal grammar is a set of symbols and the production rules for rewriting some of them into every possible string of a formal language over an alphabet. A grammar does not describe the meaning of the strings — only their form. In applied m ...
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 in example
SQL Structured Query Language (SQL) (pronounced ''S-Q-L''; or alternatively as "sequel") is a domain-specific language used to manage data, especially in a relational database management system (RDBMS). It is particularly useful in handling s ...
database In computing, a database is an organized collection of data or a type of data store based on the use of a database management system (DBMS), the software that interacts with end users, applications, and the database itself to capture and a ...
s and as a 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 corporation and technology company, technology conglomerate headquartered in Redmond, Washington. Founded in 1975, the company became influential in the History of personal computers#The ear ...
and
Oracle An oracle is a person or thing considered to provide insight, wise counsel or prophetic predictions, most notably including precognition of the future, inspired by deities. If done through occultic means, it is a form of divination. Descript ...
.


See also

* Metavariable (logic) * xyzzy *
Alice and Bob Alice and Bob are fictional characters commonly used as placeholders in discussions about cryptography, cryptographic systems and Cryptographic protocol, protocols, and in other science and engineering literature where there are several partici ...
*
John Doe John Doe (male) and Jane Doe (female) are multiple-use placeholder names that are used in the British, Canadian, and American legal systems, when the true name of a person is unknown or is being intentionally concealed. In the context of law ...
* Fnord *
Free variables and bound variables In mathematics, and in other disciplines involving formal languages, including mathematical logic and computer science, a variable may be said to be either free or bound. Some older books use the terms real variable and apparent variable for f ...
*
Gadget A gadget is a machine, mechanical device or any ingenious article. Gadgets are sometimes referred to as ''wikt:gizmo, gizmos''. History The etymology of the word is disputed. The word first appears as reference to an 18th-century tool in Glass ...
*''
Lorem ipsum ''Lorem ipsum'' ( ) is a dummy or placeholder text commonly used in graphic design, publishing, and web development. Its purpose is to permit a page layout to be designed, independently of the copy (publishing), copy that will subsequently pop ...
'' *
Nonce word In linguistics, a nonce word—also called an occasionalism—is any word (lexeme), or any sequence of sounds or letters, created for a single occasion or utterance but not otherwise understood or recognized as a word in a given languag ...
*
Placeholder name Placeholder names are intentionally overly generic and ambiguous terms referring to things, places, or people, the names of which or of whom do not actually exist; are temporarily forgotten, or are unimportant; or in order to avoid stigmat ...
* Widget * Smurf


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. The noun "commonwealth", meaning "public welfare, general good or advantage", dates from the 15th century. Originally a phrase (the common-wealth ...
Hackish'', such as ''wombat''.
Variable "foo" and Other Programming Oddities
Placeholder names Metalogic Variable (computer science) Syntax (logic)