Wednesday, September 25, 2019

What is foo , bar , baz really mean?

foo, bar , baz, foonley are metasyntactic variables.
metasyntactic variables are used in formal logic, and used in spoken languages
metasyntactic variable is a specific word or set of words identified as a placeholder in computer science and specifically computer programming. These words are commonly found in source code and are intended to be modified or substituted to be applicable to the specific usage before compilation (translation to an executable).
The words foo and bar are good examples as they are used in over 330 Internet Engineering Task Force Requests for Comments, which are documents explaining foundational internet technologies like HTTP (websites), TCP/IP, and email protocols.
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.
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.
Due to English being the foundation-language, or lingua franca, 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.

General usage

Metasyntactic variables used commonly across all programming languages include foobarfoobarbazquxquuxquuzcorgegraultgarplywaldofredplughxyzzythud, Wibblewobblewubble, and flob are also used in the UK.
A complete reference can be found in a MIT Press book titled The Hacker's Dictionary.

Usage

In C & C++ programming languages foo  and bar are used as function names and variables.

In Python programming language : Spamham, and eggs are the principal metasyntactic variables used in the Python programming language. This is a reference to the famous comedy sketch, "Spam", by Monty Python, the eponym of the language.