Misplaced Pages

Foobar: Difference between revisions

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
Browse history interactively← Previous editNext edit →Content deleted Content addedVisualWikitext
Revision as of 12:12, 7 May 2021 editMarisauna (talk | contribs)Extended confirmed users7,281 editsm History and etymology← Previous edit Revision as of 13:54, 11 May 2021 edit undoWhenthekek (talk | contribs)1 editm They missed some coding languages so I feel like I had the need to put it.Tag: RevertedNext edit →
Line 9: Line 9:
The etymology of foobar could be derived from the ]-era military slang ], which was ] to ''foobar''.<ref name="dictionary">{{Cite web|url=https://www.dictionary.com/e/foo/|title=What does foo mean?|publisher=]|access-date=2019-08-17}}</ref> The word ''foo'' on its own was used earlier. Between about 1930 and 1952 it appeared in the comic '']'' by ], who stated that he used the word due to having seen it on the bottom of a jade Chinese figurine in ], purportedly signifying "good luck".<ref>{{Cite web|url=https://www.smokey-stover.com/history.html|title=The History of Bill Holman|date=2007-06-13|publisher=]|access-date=2019-08-17}}</ref> If true, this is related to the Chinese word ''fu'' ("{{lang|zh|福}}", sometimes transliterated ''foo'', as in '']''), which can mean ''happiness'' or ''blessing''.<ref name="dictionary" /> The etymology of foobar could be derived from the ]-era military slang ], which was ] to ''foobar''.<ref name="dictionary">{{Cite web|url=https://www.dictionary.com/e/foo/|title=What does foo mean?|publisher=]|access-date=2019-08-17}}</ref> The word ''foo'' on its own was used earlier. Between about 1930 and 1952 it appeared in the comic '']'' by ], who stated that he used the word due to having seen it on the bottom of a jade Chinese figurine in ], purportedly signifying "good luck".<ref>{{Cite web|url=https://www.smokey-stover.com/history.html|title=The History of Bill Holman|date=2007-06-13|publisher=]|access-date=2019-08-17}}</ref> If true, this is related to the Chinese word ''fu'' ("{{lang|zh|福}}", sometimes transliterated ''foo'', as in '']''), which can mean ''happiness'' or ''blessing''.<ref name="dictionary" />


The first known use of the terms in print in a programming context appears in a 1965 edition of MIT's '']''.<ref>{{cite book|url=https://books.google.com/books?id=aOQRAQAAMAAJ&q=foobar|title=Tech Engineering News|volume=47|year=1965|publisher=]|page=63|quote=Further, it is possible to search for an effective address; e.g., if an instruction such as "add 1 foo" were used, specifying indirect addressing thru location "foo", and location "foo" contained the address of location "foobar", then an effective word search for "foobar" would find location "foo" and the location containing the "add" instruction as well.}}</ref> ''Foobar'' may have come about as a result of the pre-existing "Foo" being conjoined with "bar", an addition borrowed from the military's FUBAR. The use of ''foo'' in a programming context is generally credited to the ] (TMRC) of ] from circa 1960.<ref name="rfc3092" /> In the complex model system, there were ] switches located at numerous places around the room that could be thrown 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. 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". Because of this, an entry in the 1959 ''Dictionary of the TMRC Language'' went something like this: "FOO: The first syllable of the misquoted sacred chant phrase '].' Our first obligation is to keep the foo counters turning."<ref>{{cite web|url=https://www.computer-dictionary-online.org/definitions-f/foo.html|title=Computer Dictionary Online}}, computer-dictionary-online.org</ref> One book{{which|date=November 2010}} describing the MIT train room describes two buttons by the door labeled "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. An entry in the ''Abridged Dictionary of the TMRC Language'' states:<ref>{{cite web|url=http://tmrc.mit.edu/dictionary.html#FOO|title=Abridged Dictionary of the TMRC Language|publisher=Tech Model Railroad Club of ]|access-date=2013-03-12|archive-url=https://web.archive.org/web/20180102215225/http://tmrc.mit.edu/dictionary.html#FOO|archive-date=2 January 2018|url-status=dead}}</ref> The first known use of the terms in print in a programming context appears in a 1965 edition of MIT's '']''.<ref>{{cite book|url=https://books.google.com/books?id=aOQRAQAAMAAJ&q=foobar|title=Tech Engineering News|volume=47|year=1965|publisher=]|page=63|quote=Further, it is possible to search for an effective address; e.g., if an instruction such as "add 1 foo" were used, specifying indirect addressing thru location "foo", and location "foo" contained the address of location "foobar", then an effective word search for "foobar" would find location "foo" and the location containing the "add" instruction as well.}}</ref> ''Foobar'' may have come about as a result of the pre-existing "Foo" being conjoined with "bar", an addition borrowed from the military's FUBAR. The use of ''foo'' in a programming context is generally credited to the ] (TMRC) of ] from circa 1960.<ref name="rfc3092" /> In the complex model system, there were ] switches located at numerous places around the room that could be thrown 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. 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". Because of this, an entry in the 1959 ''Dictionary of the TMRC Language'' went something like this: "FOO: The first syllable of the misquoted sacred chant phrase '].' Our first obligation is to keep the foo counters turning."<ref>{{cite web|url=https://www.computer-dictionary-online.org/definitions-f/foo.html|title=Computer Dictionary Online}}, computer-dictionary-online.org</ref> One book{{which|date=November 2010}} describing the MIT train room describes two buttons by the door labeled "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. An entry in the ''Abridged Dictionary of the TMRC Language'' states:<ref>{{cite web|url=http://tmrc.mit.edu/dictionary.html#FOO|title=Abridged Dictionary of the TMRC Language|publisher=Tech Model Railroad Club of ]|access-date=2013-03-12|archive-url=https://web.archive.org/web/20180102215225/http://tmrc.mit.edu/dictionary.html#FOO|archive-date=2 January 2018|url-status=dead}}</ref> It can also be used in coding languages such as python, java, and repl.it. https://repl.it to see about le pog foo bar baz.


{{Quote|text = Multiflush: stop-all-trains-button. Next best thing to the red door button. Also called FOO. Displays "FOO" on the clock when used.}} {{Quote|text = Multiflush: stop-all-trains-button. Next best thing to the red door button. Also called FOO. Displays "FOO" on the clock when used.}}

Revision as of 13:54, 11 May 2021

Use of metasyntactic variables in computer programming Not to be confused with FUBAR or Foobar2000. "Foo" redirects here. For other uses, see Foo (disambiguation).

The terms foobar (/ˈfuːbɑːr/), foo, bar, baz, and others are used as metasyntactic variables and placeholder names in computer programming or computer-related documentation. They have been used to name entities such as variables, functions, and commands whose exact identity is unimportant and serve only to demonstrate a concept.

History and etymology

Smokey Stover driving a "foomobile"

The etymology of foobar could be derived from the World War II-era military slang FUBAR, which was bowdlerised to foobar. The word foo on its own was used earlier. Between about 1930 and 1952 it appeared in the comic Smokey Stover by Bill Holman, who stated that he used the word due to having seen it on the bottom of a jade Chinese figurine in San Francisco Chinatown, purportedly signifying "good luck". If true, this is related to the Chinese word fu ("福", sometimes transliterated foo, as in foo dog), which can mean happiness or blessing.

The first known use of the terms in print in a programming context appears in a 1965 edition of MIT's Tech Engineering News. Foobar may have come about as a result of the pre-existing "Foo" being conjoined with "bar", an addition borrowed from the military's FUBAR. The use of foo in a programming context is generally credited to the Tech Model Railroad Club (TMRC) of MIT from circa 1960. In the complex model system, there were scram switches located at numerous places around the room that could be thrown 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. 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". Because of this, an entry in the 1959 Dictionary of the TMRC Language went something like this: "FOO: The first syllable of the misquoted sacred chant phrase 'foo mane padme hum.' Our first obligation is to keep the foo counters turning." One book describing the MIT train room describes two buttons by the door labeled "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. An entry in the Abridged Dictionary of the TMRC Language states: It can also be used in coding languages such as python, java, and repl.it. https://repl.it to see about le pog foo bar baz.

Multiflush: stop-all-trains-button. Next best thing to the red door button. Also called FOO. Displays "FOO" on the clock when used.

The shift from the military expression FUBAR to foobar may also have been driven by the latter being a computer science pun. Since overbars designate repeating decimal numbers, the word foobar also signifies a number in hexadecimal, a base typically used in low-level programming. That number is 0.F00F00F00 ..., which equals the decimal fraction 256/273.

The term foobar was propagated through computer science circles in the 1960s and early 1970s by system manuals from Digital Equipment Corporation. Foobar was also used as a variable name in the Fortran code of Colossal Cave Adventure (1977 Crowther and Woods version). The variable FOOBAR was used to contain the player's progress in saying the magic phrase "Fee Fie Foe Foo". Intel also used the term foo in their programming documentation in 1978.

Example use in code

In this Hello, World! code sample in C, foo and bar are used to illustrate string substitution:

#include <stdio.h>
int main() {
   const char *foo = "Hello";
   const char *bar = "World!";
   fprintf(stdout, "%s %s\n", foo, bar);
   return 0;
}

In this Scheme code sample, foobar is used to illustrate the name of a function:

(define foobar
   (lambda (x)
      (display x)))
(foobar "Hello World!")

In this Hello, World! code sample in Python, foo and bar are used to illustrate the names of the strings printed to STDOUT.

foo = "Hello"
bar = "World"
print(foo, bar)

In this Hello, World! code sample in C#, foo and bar are used to illustrate the names of the strings.

string foo = "Hello";
string bar = "World";
Console.WriteLine(foo + bar);

Examples in language

See also

References

  1. ^ RFC 3092 - Etymology of "Foo"
  2. ^ "What does foo mean?". Dictionary.com. Retrieved 2019-08-17.
  3. "The History of Bill Holman". Smokey Stover. 2007-06-13. Retrieved 2019-08-17.
  4. Tech Engineering News. Vol. 47. Massachusetts Institute of Technology. 1965. p. 63. Further, it is possible to search for an effective address; e.g., if an instruction such as "add 1 foo" were used, specifying indirect addressing thru location "foo", and location "foo" contained the address of location "foobar", then an effective word search for "foobar" would find location "foo" and the location containing the "add" instruction as well.
  5. "Computer Dictionary Online"., computer-dictionary-online.org
  6. "Abridged Dictionary of the TMRC Language". Tech Model Railroad Club of MIT. Archived from the original on 2018-01-02. Retrieved 2013-03-12.
  7. MCS-86 Assembler Operating Instructions For ISIS-II Users (A32/379/10K/CP ed.). Santa Clara, California, USA: Intel Corporation. 1978. Manual Order No. 9800641A. Retrieved 2020-02-29.
  8. Mike Ricciuti (2002-07-04). "Microsoft ploy to block Sun exposed". CNET. Retrieved 2019-08-17.
  9. Alistair Charlton (2015-08-27). "Google Foobar: How searching the web earned a software graduate a job at Google". International Business Times. Retrieved 2019-08-17.

External links

Categories: