Metasyntactic Variable - Examples

Examples

RFC 772 (cited in RFC 3092) contains for instance:

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 IETF RFCs are rendered in plain text, making it necessary to distinguish metasyntactic variables by a naming convention, more or less obvious from context. If rich text formatting is available, e.g. as in the HTML produced from texinfo sources, then a typographical convention may be used, as done for the example in the GNU Fortran manual:

A metasyntactic variable—that is, a name used in this document to serve as a placeholder for whatever text is used by the user or programmer—appears as shown in the following example:

“The INTEGER ivar statement specifies that ivar is a variable or array of type INTEGER.”

In the above example, any valid text may be substituted for the metasyntactic variable ivar to make the statement apply to a specific instance, as long as the same text is substituted for both occurrences of ivar.

The above example uses italics to denote metavariables (borrowing from the common convention to use italics for variables in mathematics), although italics are also used in the same text for emphasizing other words. (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.")

A third example of the use of the "metasyntactic variables" foo and bar, this time as actual identifiers in a programming (interview) example is contrasting the following C++ function prototypes for their different argument passing mechanisms:

void foo(Fruit bar); void foo(Fruit* bar); void foo(Fruit& bar);

Read more about this topic:  Metasyntactic Variable

Famous quotes containing the word examples:

    Histories are more full of examples of the fidelity of dogs than of friends.
    Alexander Pope (1688–1744)

    It is hardly to be believed how spiritual reflections when mixed with a little physics can hold people’s attention and give them a livelier idea of God than do the often ill-applied examples of his wrath.
    —G.C. (Georg Christoph)

    No rules exist, and examples are simply life-savers answering the appeals of rules making vain attempts to exist.
    André Breton (1896–1966)