News for hackers. Stuff that matters.
Re:What is the history of the use of "foo" and "bar" in sour... by maccard on Saturday October 05, 2024 @05:23PM (#41753027)
> 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.

Re:What is the history of the use of "foo" and "bar" in sour... by hedvig23 on Saturday October 05, 2024 @05:51PM (#41753215)
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.
Re:What is the history of the use of "foo" and "bar" in sour... by jiggawatts on Saturday October 05, 2024 @06:27PM (#41753379)
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.
Re:What is the history of the use of "foo" and "bar" in sour... by thaumasiotes on Saturday October 05, 2024 @06:46PM (#41753470)
> 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. "R" -> "s" is attested in Latin, presumably because "z" wasn't an option. (Latin fricatives don't have voicing distinctions.)

For an only slightly different current example, the second consonants in "virile" and "vision" 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.

Re:What is the history of the use of "foo" and "bar" in sour... by maccard on Monday October 07, 2024 @04:09PM (#41770427)
Show me a phrase and I'll show you a language it doesn't work in.
Re:What is the history of the use of "foo" and "bar" in sour... by thaumasiotes on Monday October 07, 2024 @04:39PM (#41770781)
Is there a language that identifies "ta" and "pa"?
Re:What is the history of the use of "foo" and "bar" in sour... by bshacklett on Sunday October 06, 2024 @07:43PM (#41761342)
It’s the same idea that drove Lorem Ipsum for type setting placeholders.