Skip to content

the curious origin of the variables FOO and BAR

26 mayo, 2021

To weave a universal network like the Internet, where everyone wants meddle and adapt it to your liking, historically it has been necessary to make the decision to create a formal registry of the protocols to be used, modifications to them and improvements. It is about the Request For Comments, a set of documents that narrate the history of the Internet since it was Arpanet, as well as the successive changes made to it.

And to give you an idea of ​​how strict this documentation is, you just have to look at the definition given to the typical variables that are usually used in the example code since computing is such: foo, Pub and its combination foobar. Both are defined in the RFC 3092 due to the need to give them meaning, since as the document itself stated:

About 212 RFCyes, starting with the RFC 269, contain the terms `foo ‘,` bar’ or `foobar ‘as if they were metasyntactic variables, without adding any adequate explanation or definition.

The most curious thing, without a doubt, is the formal nature of the document to explain something as trivial as the name of two variables chosen at random. In fact, before even explaining it, they give a first definition of FOO quite according to the image that illustrates this article:

foo / foo /

1. Interjection. Expression of disgust or outrage.

I do not know to what extent what is stated in the RFC, but apparently the origin of the variables comes from the expression, coined in World War II, FUBAR, an acronym for “Fucked Up Beyond All Repair”, something like “Fucked, but completely”.

But it’s more, apparently foo became a wildcard word in American culture, and it was common to see it in comics and comics between the 1930s and 1950s, whether it was on car license plates and background elements, or as a euphemism for swear words.

Duffy Doc holding a sign of

The first surviving reference in this regard is this 1938 image of The Daffy Doc, (one of the first adventures of Duffy Duck, which in Spain is known as the Lucas Duck), holding a sign that says “Silence is foo”. Other comics where the term appeared regularly were Smokey Stover Y Pogo.

Perhaps due to its use as a wild card, in the military sphere it began to be called foo-fighters to the unknown elements sneaking into the radar, giving foo back the meaning that it could be “anything”. Over time, this expression was lost as the Anglo-Saxons preferred the term UFO to refer to UFOs.

And in that military environment, where he was born fubar and where it was still used foo, which had already disappeared from popular culture, the United States Department of Defense created ARPANET, and with it came the RFC and the first written references to foo and bar (and baz, what, corge, grault, garply, waldo, fred, plugh, xyzzy Y thud) as variable names, since being words devoid of meaning, they served perfectly to name anything.

A very curious story and very well drawn in this RFC, which perhaps makes us value the choice of the name of our variables much more, and give foo, bar and company a chance rather than using the bland x, y, z.

More information | RFC 3092 and its translation into Spanish
Image | Still from The Daffy Doc