Please, please, stop using "foo" and "bar” in code documentation. Give us real examples that mean something. Not "if (foo > bar)," but “if (height > limit)." Not “foo++” but “counter++”. Give us a logical hook to hang our hat on, not nonsense words.
@waldoj I came across this one time in Wikipedia and it completely ruined the ability to understand what the hell they were talking about. Then I edited the article to use real words and it was immediately understandable
@SwiftOnSecurity Every time I read the jq manual, I get annoyed at how hard it is to follow for this reason. It's a great tool but its manual is really dragged down with all the foo/bar/baz nonsense. https://stedolan.github.io/jq/manual/#Basicfilters
jq Manual (development version)

@waldoj @SwiftOnSecurity It has never made things much worse for me, but I've never been particularly sure why it was a practice either.

@lispi314 @waldoj @SwiftOnSecurity I have to say I am a bit baffled that people find the foo/bar convention to be confusing when used to document in a generic way. To me, it is just like the convention of using x in math.

The whole point is they are easy to recognize as things you need to replace.

However I realize some newer programmers consider this convention to be a kind of gate-keeping by us old-timers, and that would be bad. So maybe it is time to stop using our cherished foo and bar.

@eob

it's not that it's confusing to follow (tho it can be), it's that it's way harder to make examples stick in memory compared to names that describe their use. additionally, if your primary language is far from english's pronunciations/word boundaries/etc it makes it a lot more inscrutable. cutesy names aren't worth the cost.

And I've met CS undergrads who don't know. so, seems worth just not using. naming's hard, but you write once and read many

@lispi314 @waldoj @SwiftOnSecurity

@NireBryce @lispi314 @waldoj @SwiftOnSecurity I agree that if there are names that describe the use, they should be used instead of foo and bar

But sometimes the description is inherently abstract. Take this random example from the invert-kv docs:

Example: {foo: 'bar'} → {bar: 'foo'}

if you used something specific instead like

Example: {size: 'big'} → {big: 'size'}

then the reader might be confused whether the property had to be size or not. With foo/bar it's clear the names are arbitrary

@eob @NireBryce @lispi314 @waldoj @SwiftOnSecurity

In that specific case I think a more distinct pair might help. A typical number key to string value mapping, maybe?

Example: {3: "frog"} → {"frog": 3}

The actual example also throws a rainbow and unicorn emoji in there, which definitely feel like they make the foo/bar problem even worse to me.

@eob @NireBryce @lispi314 @waldoj @SwiftOnSecurity I have a certain historical fondness for 'foo' and 'bar', just like I have a fondness for the ridiculous, short shell commands. But I have to admit that it's too cute and a bit lazy. It's not the worst thing you can do though -- some ripgrep docs use NEEDLE, as in "needle in a haystack" which is completely opaque if you don't know the allusion. 'foo' would have been better there, but 'pattern' would have been far better than either.

@NireBryce @eob @lispi314 @waldoj @SwiftOnSecurity replacing x with apple will distract new learners with the semantics.

Like, you have 4 apples and split between 2 people, are the apples of the same size, is that fair.
Can't they cut the apples.