5 ms·
It is silly, but even small things like foo and bar could be a barrier or distraction at least. At least I am thinking more about 'Why the heck foo and bar? Why
by mihaaly 4y ago
It is silly, but even small things like foo and bar could be a barrier or distraction at least. At least I am thinking more about 'Why the heck foo and bar? Why?! Why not A or B or other more neutral and common? What could be the hidden meaning?...' than about the logic of the example.
- emsixteen 4y agoI really dislike when people use foo and bar. Use something with some meaning imo.
- marssaxman 4y agoThat's the point, though; you use 'foo' and 'bar' when you want the reader to focus on an abstraction, instead of potentially distracting them with the details of a concrete situation.
- ThrowawayTestr 4y agoEvidently the abstraction can also be the distraction.
- jameshart 4y agoOnce the ‘programming bit’ is flipped in someone’s brain, I think metasyntactic variables like foo and bar become very instinctive and easy to reason about. You have activated the part of your brain that visualizes things as abstractions with placeholders. The problem is when foo and bar are used in material aimed at beginning programmers who are still developing that instinct and who haven’t yet got that bit set.
- jkingsbery 4y agoFor example - sometimes people get confused about what is meant by a "faucet," and so using "faucet" as a variable name could lead to confusion.
- civopsec 4y agoI think of a crowbar and martial arts. Ugh, it’s actually much more distracting than the serene A-B-C, X-Y-C, and so on.
- deleted 4y ago[deleted]
- chasil 4y agoOh, it very much has meaning. https://en.wikipedia.org/wiki/FUBAR_(disambiguation) https://en.wikipedia.org/wiki/FUBAR_(disambiguation)
- emsixteen 4y agoYeah, I know, but obviously I mean meaning in relation to the context. :)
- mh-cx 4y agoSorry to be nitpicking: https://en.wikipedia.org/wiki/Foobar "Foobar Not to be confused with FUBAR or Foobar2000." It's linked from FUBAR but not under "disambiguation" but "See also".
- fknorangesite 4y agoWell, yeah. But also: > It is possible that foobar is a playful allusion to the World War II-era military slang FUBAR (Fucked Up Beyond All Recognition). https://en.wikipedia.org/wiki/Foobar https://en.wikipedia.org/wiki/Foobar Which is certainly how I've always understood it.
- wizofaus 4y agoIt seems the "foo" didn't come from that, but once "foo" was in wide adoption, the "bar" likely suggested itself automatically to someone familiar with "fubar".
- bitwize 4y ago"Foo" and "bar" are hacker culture signifiers, like "yo" and "word up" are hip-hop culture signifiers. Even if you don't consider yourself a part of hacker culture, understanding its history and peculiar lingo is probably a good idea if you contribute to a site known as "Hacker News". The Jargon File, though largely historical and obsolete, is a good place to start: https://catb.org/esr/jargon/ https://catb.org/esr/jargon/
- kqr 4y agoYup. The point of an example is to let the learner leverage their intuition about one concept to guide their understanding of the other. It requires realistic examples. Nobody has useful intuition around what a "foo" is. It contradicts the very point of an example. (It is useful to illustrate syntax, though!)
- emsixteen 4y ago100% agreed. I get the point of it, I just think that it's useless in examples.
- FredPret 4y agoIt comes from fubar, which stands for “fucked up beyond all recognition”. Foo and bar it seem so innocent and whimsical by comparison
- bitwize 4y ago"Foo" dates earlier: https://news.ycombinator.com/item?id=33747944 https://news.ycombinator.com/item?id=33747944 https://catb.org/jargon/html/F/foo.html https://catb.org/jargon/html/F/foo.html It was probably paired with "bar" because of FUBAR though. My dad referred to the figure known as the "impossible trident" ( https://en.m.wikipedia.org/wiki/Impossible_trident https://en.m.wikipedia.org/wiki/Impossible_trident ) as a "foobar". It was used as a warning to engineering students to check their technical drawings.