foo function

Stupid question:

I found the testing foo function everywhere. What it means?
It's a common name for a function when we don't care what the function is named. Often paired with the bar function.
Last edited on
closed account (3hM2Nwbp)
What it means?


I've always thought it to be related to FUBAR.

http://en.wikipedia.org/wiki/FUBAR
ESR's 'The New Hacker's Dictionary' (aka The Jargon File) Version 4.2.2:
foo /foo/ 1. interj. Term of disgust. 2. Used very generally as a sample name for absolutely anything 3. First on the standard list of metasyntactic variables used in syntax examples.

When `foo' is used in connection with `bar' it has generally traced to the WWII−era Army slang FUBAR ...

It now seems more likely that FUBAR was itself a derivative of `foo' perhaps influenced by German `furchtbar' (terrible) - `foobar' may actually have been the original form. For, it seems, the word `foo' itself had an immediate prewar history in comic strips and cartoons. The earliest documented uses were in the "Smokey Stover" comic strip popular in the 1930s, which frequently included the word "foo". ...

According to the Warner Brothers Cartoon Companion, Bill Holman, the author of the strip, claimed to have found the word "foo" on the bottom of a Chinese figurine. This is plausible; Chinese statuettes often have apotropic inscriptions, and this may have been the Chinese word `fu' (sometimes transliterated `foo'), which can mean "happiness" when spoken with the proper tone (the lion-dog guardians flanking the steps of many Chinese restaurants are properly called "fu dogs"). English speakers' reception of Holman's `foo' nonsense word was undoubtedly influenced by Yiddish `feh' and English `fooey' and `fool'. Holman's strip featured a firetruck called the Foomobile that rode on two wheels. The comic strip was tremendously popular in the late 1930s, and legend has it that a manufacturer in Indiana even produced an operable version of Holman's Foomobile. According to the Encyclopedia of American Comics, `Foo' fever swept the U.S., finding its way into popular songs and generating over 500 `Foo Clubs.' The fad left `foo' references embedded in popular culture (including a couple of appearances in Warner Brothers cartoons of 1938-39) but with their origins rapidly forgotten.

...

In the 1959 "Dictionary of the TMRC Language", compiled at TMRC, there was an entry that went something like this: FOO: The first syllable of the sacred chant phrase "FOO MANE PADME HUM." Our first obligation is to keep the foo counters turning. ... Almost the entire staff of what later became the MIT AI Lab was involved with TMRC, and the word spread from there.

----------------------------------------------------------------------------------------------------------

TMRC /tmerk'/ n. The Tech Model Railroad Club at MIT, one of the wellsprings of hacker culture. The 1959 "Dictionary of the TMRC Language" compiled by Peter Samson included several terms that became basics of the hackish vocabulary (see foo, mung, and frob). By 1962, TMRC's legendary layout was already a marvel of complexity and has grown in the years since. ... There were scram switches located at numerous places around the room that could be thwacked if something undesirable was about to occur, such as a train going full-bore at an obstruction. Another feature of the system was a digital clock on the dispatch board, which was itself something of a wonder in those bygone days before cheap LEDs and seven-segment displays. When someone hit a scram switch the clock stopped and the display was replaced with the word `FOO'; at TMRC the scram switches are therefore called `foo switches'.


Wiki (foobar):
One book describing the MIT train room describes two buttons by the door: labelled foo and bar. These were general purpose buttons and were often re-purposed for whatever fun idea the MIT hackers had at the time. Hence the adoption of foo and bar as general purpose variable names.


RFC3092 http://tools.ietf.org/html/rfc3092 has even more exotic takes on the etymology of foo:
Approximately 212 RFCs, or about 7% of RFCs issued so far, starting with RFC269, contain the terms `foo', `bar', or `foobar' used as a metasyntactic variable without any proper explanation or definition. This may seem trivial, but a number of newcomers, especially if English is not their native language, have had problems in understanding the origin of those terms. This document rectifies that deficiency.
...
4. Prince Foo was the last ruler of Pheebor and owner of the Phee Helm, about 400 years before the reign of Entharion. When Foo was beheaded by someone he called an "eastern fop" from Borphee, the glorious age of Pheebor ended, and Borphee rose to the prominence it now enjoys.

5. A 13th-16th century usage for the devil or any other enemy. The earliest citation it gives is from the year 1366, Chaucer: "Lat not our alder foo [devil] make his bobance [boast]". Chaucer's "Foo" is probably related to modern English "foe".

6. Rare species of dog. A spitz-type dog discovered to exist after having long been considered extinct, the Chinese Foo Dog, or Sacred Dog of Sinkiang, may have originated through a crossing of Northern European hunting dogs and the ancient Chow Chow from Mongolia or be the missing link between the Chinese Wolf and the Chow Chow. It probably derives its name from foochow, of the kind or style prevalent in Foochow, of or from the city of Foochow (now Minhow) in southeast China.


Topic archived. No new replies allowed.