[HN Gopher] What is the history of the use of "foo" and "bar" in...
___________________________________________________________________
What is the history of the use of "foo" and "bar" in source code
examples? (2012)
Author : squircle
Score : 60 points
Date : 2024-10-05 19:52 UTC (3 hours ago)
(HTM) web link (softwareengineering.stackexchange.com)
(TXT) w3m dump (softwareengineering.stackexchange.com)
| helph67 wrote:
| "In World War One "Foo was here" was scrawled across camps
| occupied by the Australian Expeditionary Force. Generally assumed
| to have come from the acronym for Forward Observation Officer,
| veterans of that war may have brought the tradition with them
| into the next global conflict over two decades later"
| https://taskandpurpose.com/history/the-story-of-kilroy-and-w...
| jph wrote:
| In addition to the military-programming history of "foo", there's
| also a military-programming history for the variable naming
| convention of "alfa", "bravo", "charlie", "delta", etc.
|
| The naming convention is known as the NATO phonetic alphabet:
| https://en.wikipedia.org/wiki/NATO_phonetic_alphabet
| Cheer2171 wrote:
| NATO phonetic alphabet is used in all areas where you have to
| say letters over voice.
|
| One character variable names for temp or iterator values are
| everywhere in programming. But I've never ever encountered one
| spelled out as a full transcriptions of the NATO phonetic
| alphabet like alfa, bravo, charlie. Exception is alpha for
| probability/statistics.
| g4zj wrote:
| Some of them could potentially be a little confusing as well,
| such as "delta" in game development, "echo" in some
| networking contexts, or "uniform" in OpenGL shaders.
|
| I don't tend to use single-letter variable names outside of
| the standard `for(;;)` syntax, but if I did, I don't think
| I'd replace them in this way.
| mindcrime wrote:
| > NATO phonetic alphabet is used in all areas where you have
| to say letters over voice.
|
| Not all. Military definitely favors NATO, but there are other
| phonetic alphabets in use. In particular, at least in the US,
| fire/ems personnel (and sometimes also law enforcement) use
| alternatives. The one that goes Adam, Boy (or Baker),
| Charlie, David, Edward, Frank, ... is still widely used.
|
| I've also known agencies to use a mix, like Adam, Baker,
| Charlie, Delta, ... (a law enforcement agency that I
| dispatched for back in the 1990's used this version).
|
| Source: was a firefighter and 911 dispatcher in a previous
| life and still spend a lot of time monitoring fire/ems
| channels locally just to stay connected to that world.
| zabzonk wrote:
| > "alfa", "bravo", "Charlie", "delta"
|
| Bit offtopic: As well as general use, a lot of thesed are used
| to classify Soviet/Russien submarines from a NATO point of use.
|
| Even more off topic:This is quite interesting (to me at last)
| in that NATO has used prefix schemes for bombers, fighters etc.
| (for example Bear (bomber), Fishbed (fighter)) rather than
| their makers names. As far as I know, in WW2 the Germans always
| referred to RAF fighters by their RAF names.
| wlindley wrote:
| In the 1940s, the Army used a phonetic alphabet starting Able,
| Baker, Charlie. My late father was on the first two postwar
| atomic bomb tests (the first after Trinity, and at Hiroshima,
| Nagasaki) which were Able and Baker.
|
| Able was an air burst over Bikini (thus the name of the
| swimsuit).
|
| Baker, the water burst, was the world's first atomic disaster;
| as a result of Baker, the third scheduled test Charlie was
| cancelled. My father died years later of colon cancer, perhaps
| not unrelated to contaminated air and water at the Eniwetok
| base afterwards.
|
| FUBAR indeed.
| somat wrote:
| The change from able... to alpha... was a NATO thing. some
| European countries don't use the "a" in "able", so it was
| changed to the "a" in "alpha"
| fsckboy wrote:
| I don't know the story of the entry of foo into the computer
| science lexicon, but it is the case that the early days of
| computers were populated with a fair number of military veterans
| because early computers were mostly used in military applications
| so that produced people with computer experience (not to mention
| the compulsory draft which meant that a large number of people
| would have military experience anyway).
|
| FUBAR ("fucked up beyond all recognition") was supposedly a
| military slang phrase.
|
| And the popular comic strip Smoky Stover starting in the 1930's
| used the word "Foo" wrt a firefighting character perhaps giving
| that spelling more currency.
|
| this is the Foomobile from that comic
| https://duckduckgo.com/?t=ffab&q=Foomobile&iax=images&ia=ima...
| ahazred8ta wrote:
| The missing link is 'FURCHTBAR'.
|
| Smokey Stover started the meme of substituting 'foo' into
| words. 1930s german language classes turned furchtbar
| (frightful) into 'foo-bar'. The US military acronymized it into
| FUBAR. Apparently MIT adopted fu() and bar() as algebra
| placeholders.
|
| I'm partial to the 1938 song WHAT THIS COUNTRY NEEDS IS FOO -
| https://m.youtube.com/watch?v=W2pljKyCgwc
| diggan wrote:
| Seems like that retelling comes from an IETF RFC:
| https://www.ietf.org/rfc/rfc3092.txt (Etymology of "Foo")
| d0mine wrote:
| The date of the rfc is Apr 1st -- unclear how truthful it
| is.
| baggy_trough wrote:
| No love for quxx?
| howard941 wrote:
| Nope. Not even for xyxzzy
| mkl wrote:
| Scroll down. It's more commonly qux or quux.
| Max_Ehrlich wrote:
| I understand that these variables have a rich and long history,
| but if you have ever heard a professor or anybody else say "foo"
| in lecture you will understand why I detest them.
|
| They have absolutely no connection to the matter at hand. Since
| foo is often used before bar, you would think there is an
| ordering between the two but there doesn't have to be. They are
| hard to pronounce and easier to confuse.
|
| Whenever I give an example I use variable names that actually
| make sense and are related to the example. I'm glad that I have
| been fortunate to not see "foo" and "bar" anywhere in all of the
| code I've seen in recent memory.
| urbandw311er wrote:
| > they are hard to pronounce
|
| I'd find it hard to think of two words easier to pronounce--
| what do you mean by this?
| rmbyrro wrote:
| Proof that for any little thing that existed, exists, or
| could ever exist in this universe, there will be a non-zero
| list of human beings unhappy with it. Until the end of
| humanity, at least...
| jiggawatts wrote:
| I am unhappy with your characterisation of my natural human
| trait of having a preponderance for unhappiness with all
| possible outcomes.
| maccard wrote:
| > They have absolutely no connection to the matter at hand.
| Since foo is often used before bar, you would think there is an
| ordering between the two but there doesn't have to be. They are
| hard to pronounce and easier to confuse.
|
| I couldn't disagree more. The entire point is that the
| variables are disconnected from the matter at hand. They're
| widely recognised as placeholders, single syllable, distinctly
| pronounced from each other, and have an implied ordering.
| hedvig23 wrote:
| I would agree with the comment you're responding to, too
| often in tutorials or especially in off hand comments here, I
| find their usage to assume some common but unindicated
| convention or subtext and obscure the concept they're trying
| to convey.
| jiggawatts wrote:
| They're the programmer equivalent of 'x' and 'y' in
| mathematics -- which programmers don't use as generic
| variables because they're used for "math" embedded in code
| such as coordinates or measurements.
| thaumasiotes wrote:
| > distinctly pronounced from each other
|
| This isn't so much of an advantage for "bar" and "baz". Those
| sound pretty distinct to Americans, now, but "r" -> "z" is a
| known type of sound change, which implies that for some
| people they'll sound the same.
|
| For an only slightly different current example, the second
| consonants in "vi _ri_ le" and "vi _si_ on" are perceived as
| distinct in American English, but identical in Mandarin
| Chinese, which is why the sound is spelled as "r" in Hanyu
| Pinyin and as "j" in Wade-Giles.
| Brian_K_White wrote:
| The very reason you say something like foo is to _avoid_ using
| any specific example that might actually mean something and
| confuse the listener into thinking it matters and focussing on
| some irrelevant detail instead of the actual concept being
| illustrated.
|
| You detest that someone says "thing" instead of "house" or
| something?
|
| "...so you take a thing-"
|
| "what thing?"
|
| "It doesn't matter. It might be anything. So you-"
|
| "A car?"
|
| Come on man.
| douglee650 wrote:
| It's like business schools using "widget" for the product and
| "Acme" for the company -- they are dealing in concepts, not
| absolutes
| thiht wrote:
| When I started to learn programming (by myself), I had a really
| hard time understanding what foo and bar were and what they
| meant in various tutorials and blogs. I was already trying to
| learn the syntax and programming concepts, throwing some
| unknowns words in the mix did NOT help. For some time I thought
| foo had special meaning in PHP, or that it meant something in
| English (not my first language, and I was much less proficient
| in English at ~14 than I am today).
|
| Using foo bar baz qux is lazy when you can easily find
| countless examples.
| symbolicAGI wrote:
| MIT AI Lab back in the 1960s published technical reports
| containing program code.
|
| The military slang 'FUBAR' f'ed up beyond all recognition, was in
| the student and professor engineering vocabulary. The tradition
| became to use 'fu' and 'bar' as nominal function names, in same
| manner as X and Y were nominal variables.
|
| Often in the MIT technical reports, one would see 'x = fu(y)' or
| 'y > bar(z)' and so forth. If you knew, you knew.
|
| A few years later, perhaps with the welcome progress of more
| female faculty and students, textbooks changed the spelling, but
| not the pronunciation of the vulgar acronym 'fu' to 'foo'. Again,
| if you knew, you knew.
|
| And now you all know.
| stackghost wrote:
| Why would women in particular object to "fu" and not "foo"?
| jckahn wrote:
| Is it not clear what "f" and "u" is short for?
| stackghost wrote:
| Of course it is. What's not clear is what that has to do
| with women.
| jckahn wrote:
| I imagine that, due to the societal expectations
| historically placed on women, they've typically had to be
| "the adult in the room." Contrast this with men
| historically being able to get away with acting
| childishly (or worse). So when terminology used in the
| workplace is particularly vulgar, it would follow that
| women would take more issue with it than men.
| the_gorilla wrote:
| > due to the societal expectations historically placed on
| women
|
| This reads like aliens trying (and failing) to figure out
| why women act more like women than men do.
| jckahn wrote:
| Can you elaborate on that? My goal was to be as clear as
| possible and leave minimal room for misinterpretation.
| b59831 wrote:
| This is a sexist statement
| snypher wrote:
| 'F--- you'
| kevinventullo wrote:
| In this case the u stands for "up": https://www.merriam-
| webster.com/dictionary/fubar
| the_gipsy wrote:
| No
| __MatrixMan__ wrote:
| In the 60's the belief was that they could not tolerate
| profanity. Or maybe it was that they'd tattle on the rest of
| us.
| symbolicAGI wrote:
| Back in the 1960s United States, women were often perceived
| as more sensitive to public profanity, compared to men of the
| same age.
| the_gipsy wrote:
| Because they are subject both to sexual harassment and to
| higher expectations, including "professionalism" (not using
| profanity at the workplace in this specific case).
| b59831 wrote:
| This isn't an answer to the question.
|
| Smug responses like this just means you don't actually have
| a point.
| reaperducer wrote:
| _A few years later, perhaps with the welcome progress of more
| female faculty and students, textbooks changed the spelling,
| but not the pronunciation of the vulgar acronym 'fu' to 'foo'._
|
| I was always told that fu became foo because it lined up nicely
| on screens and on paper, making the code easier to scan.
| foo = 1 bar = 2
|
| looks better than fu = 1 bar = 2
| mikewarot wrote:
| No zot? I don't remember where I picked them up. But it was
| always fubar and zot.
| temp0826 wrote:
| Never heard of zot, but baz
| douglee650 wrote:
| It blows me away that "The Jargon File" is not required canon.
| Well, it can be anachronistic and old-school-nerd-bro coded, but
| there's some primal stuff in there
|
| http://catb.org/jargon/html/
| fragmede wrote:
| maybe it's time for an update
| d0mine wrote:
| http://catb.org/jargon/html/F/foobar.html
| FooBarBizBazz wrote:
| > old-school-nerd-bro
|
| I'm trying to maintain that the nerds of yore and the bros who
| invaded in the 2010s are different groups -- in which case
| "old-school nerd bro" would be a contradiction in terms -- but
| alas "bro" has simply come to mean "male", and, to the English
| majors writing the newspaper articles, "they all look the
| same". So maybe I need to give up.
| dang wrote:
| Surprisingly little. Others?
|
| _Foo Bar came from model trains at MIT_ -
| https://news.ycombinator.com/item?id=41069963 - July 2024 (2
| comments)
|
| _The Origin of Foo and Bar_ -
| https://news.ycombinator.com/item?id=14030938 - April 2017 (1
| comment)
|
| Kind of related but not really:
|
| _foo@bar.com_ - https://news.ycombinator.com/item?id=24605949 -
| Sept 2020 (281 comments)
|
| _The Foo at bar.com_ -
| https://news.ycombinator.com/item?id=10108287 - Aug 2015 (29
| comments)
|
| _foo@bar.com is a real email address_ -
| https://news.ycombinator.com/item?id=3263021 - Nov 2011 (91
| comments)
| rsyring wrote:
| https://www.ietf.org/rfc/rfc3092.txt
| ddtaylor wrote:
| Heads up that link to bar.com goes to an advertisement to sell
| the domain now.
| lysace wrote:
| For some reason, in Sweden, the word "gazonk" is common after
| "foo" and "bar". I've never been been able to figure out why.
|
| Here's a variant:
|
| https://developer.arm.com/documentation/dui0493/i/CHDFAGEE
|
| > foo\bar\baz\gazonk\quux\bop
|
| Some Erlang reference:
|
| https://erlang.org/pipermail/erlang-questions/2009-January/0...
|
| > 43> lists:keysearch(foo, 1, [3.14, {foo,bar} | gazonk]). >
| {value,{foo,bar}}
|
| The GNU Emacs manual:
|
| https://www.gnu.org/software/emacs/manual/html_node/emacs/Li...
|
| > (setq foo '(bar zot > gazonk))
|
| https://www.epicroadtrips.us/2003/summer/nola/nola_offsite/F...:
|
| > Gazonk is often used as an alternative for baz or as a fourth
| metasyntactic variable. Some early versions of the popular editor
| Emacs used gazonk.foo as a default filename.
| thaumasiotes wrote:
| > For some reason, in Sweden, the word "gazonk" is common after
| "foo" and "bar".
|
| That doesn't look like it's a potentially Swedish word.
|
| It does resemble an English one:
| https://en.wiktionary.org/wiki/gazongas
|
| (For whatever reason, wiktionary insists on defining "gazongas"
| only as "the plural form of 'gazonga'", but the word "gazonga"
| cannot be used at all; much as with "scissors" or "pants", only
| the plural form exists.)
| golol wrote:
| foobar should die out. myvariable, mystring, myfunction etc. are
| better in every way.
| fragmede wrote:
| they're longer, for one, so no
| jonathrg wrote:
| How about x, y, f?
| creativenolo wrote:
| Is it not foo() and bar()? MyVariable and... ?
___________________________________________________________________
(page generated 2024-10-05 23:00 UTC)