[OT] Variations of "foo", "bar", etc.

  • Thread starter Joona I Palaste
  • Start date
J

Joona I Palaste

Am I the only person here to sometimes use different metasyntactic
variables than "foo", "bar", etc.? Here are some I use.

two variables: yin, yang
three variables: father, son, holy_ghost <or> athos, porthos, aramis
four variables: om, mane, padme, hum

--
/-- Joona Palaste ([email protected]) ---------------------------\
| Kingpriest of "The Flying Lemon Tree" G++ FR FW+ M- #108 D+ ADA N+++|
| http://www.helsinki.fi/~palaste W++ B OP+ |
\----------------------------------------- Finland rules! ------------/
"It sure is cool having money and chicks."
- Beavis and Butt-head
 
I

Irrwahn Grausewitz

Joona I Palaste said:
Am I the only person here to sometimes use different metasyntactic
variables than "foo", "bar", etc.? Here are some I use.

two variables: yin, yang
three variables: father, son, holy_ghost <or> athos, porthos, aramis
four variables: om, mane, padme, hum

Personally, I like "farz" and "roedel".

Some people use "oogle", "foogle", "boogle", etc.

For others, try Google[1]:
http://www.google.com/search?q=jargon+metasyntactic+variable

Irrwahn

[1] No, this this is *not* a metasyntactic variable! :)
 
G

goose

Joona I Palaste said:
Am I the only person here to sometimes use different metasyntactic
variables than "foo", "bar", etc.? Here are some I use.

two variables: yin, yang
three variables: father, son, holy_ghost <or> athos, porthos, aramis
four variables: om, mane, padme, hum

one, two, three, four ...

only gets cumbersome if you reach *ties ->twenty_seven, fifty_one

goose,
"two = one + three / four" becomes a problem
 
S

Steve Zimmerman

Joona said:
> Am I the only person here to sometimes use different metasyntactic
> variables than "foo", "bar", etc.? Here are some I use.
>
> two variables: yin, yang
> three variables: father, son, holy_ghost <or> athos, porthos, aramis
> four variables: om, mane, padme, hum
>
>

Joona,

Thank you for the cool idea.

--Steve

################# Experiment 1 (enum with switch-case) ####################

#include <stdio.h>

int main()
{
enum Tekel {
RAND_VAR_1, RAND_VAR_2, RAND_VAR_3, RAND_VAR_4
} upharsin;

int u_element;

printf("Enter upharsin element (or negative number to quit): ");
scanf("%d", &u_element);

while (u_element >= 0) {

switch (u_element) {
case RAND_VAR_1: printf("rapti_1\n");
break;
case RAND_VAR_2: printf("duorum_2\n");
break;
case RAND_VAR_3: printf("legati_3\n");
break;
case RAND_VAR_4: printf("Germanicum_4\n");
break;
default: fprintf(stderr, "Input error\n");
break;
}

printf("Enter upharsin element (or negative number to quit): ");
scanf("%d", &u_element);

}

return 0;
}

Input from keyboard: 0
Output to screen: rapti_1

Input from keyboard: 1
Output to screen: duorum_2

Input from keyboard: 2
Output to screen: legati_3

Input from keyboard: 3
Output to screen: Germanicum_4

Input from keyboard: 4
Output to screen: Input error

Input from keyboard: -1
[bash:\> ~/clang/clc/enum_case]$


EOX ###################################################################
 
B

Bruno Desthuilliers

Joona said:
Am I the only person here to sometimes use different metasyntactic
variables than "foo", "bar", etc.? Here are some I use.

two variables: yin, yang
three variables: father, son, holy_ghost <or> athos, porthos, aramis
four variables: om, mane, padme, hum
Somewhat mystical, isn't it ? (well... except for the references to Mr
Dumas 's heroes...)

In France, we are many to use toto, tata, titi, tutu... (note that all
those words have a meaning in french).

Bruno
 
T

Tom Zych

Joona said:
Am I the only person here to sometimes use different metasyntactic
variables than "foo", "bar", etc.? Here are some I use.

Someone I knew used to use names like "zebra" and "aardvark" for
function names. Except, it wasn't for MSV's. It was in production
code :p
 
I

Irrwahn Grausewitz

Sheldon Simms said:
Why not "furz" and "luder"?

The latter are actually meaningful (german) words; the former,
AFAIK, don't mean anything in any language (feel free to correct
me on this).
 
R

Randy Howard

Am I the only person here to sometimes use different metasyntactic
variables than "foo", "bar", etc.? Here are some I use.

two variables: yin, yang
three variables: father, son, holy_ghost <or> athos, porthos, aramis
four variables: om, mane, padme, hum

I think that a check for "metasyntactic variable" at the Jargon File
(any of the mirrors) on the web will show quite a few in common
use.

I've used, "foo", "bar" and "fred" for a long time. (Supposedly "Fred"
is more common among British developers, but the fact that it is
ridiculously easy to type is the reason I gravitated to it. If forced
to add a fourth, I'd use "mary", with no good reason why.
 
A

ArWeGod

Joona I Palaste said:
Am I the only person here to sometimes use different metasyntactic
variables than "foo", "bar", etc.? Here are some I use.

Well, actually, I'm against this practice. I don't see why a reasonable name
can't be used. I think programmers like to be arcane and chose these names
to be cutesy. I don't have a lot of time to try to figure out examples with
such names. I had never even thought about it until I read a letter in Dr.
Dobb's Journal stating what I just said.

Now those articles the letter writer was talking about were generally real
code used in example to a real situation. I can see where you might have a
function SO abstract that foo, bar, baz, etc. might be used. But an example
is supposed to explain something, so why are we making harder to understand?

Compare this to the following:

void foo (void)
{
int baz;
baz = bar (baz);
}

int bar (int tuti)
{
++tuti;
return (tuti);
}

What's wrong with something like this instead:

void main (void)
{
int i;
i = addone (i);
}

int addone (int input)
{
++input;
return (input);
}

Flame-prevention statement: I am not saying, "What's wrong with this code".
OK? It an example of an example. Don't correct the code, please. Try to grok
the message, which is, "Why not use real names for variables?"
 
M

Martin Ambuhl

ArWeGod wrote:

What's wrong with something like this instead:

void main (void)

What's wrong?! How dare you post code in which main has a return type of
'void' and ask "what's wrong"?
 
B

Bruno Desthuilliers

ArWeGod said:
Well, actually, I'm against this practice. I don't see why a reasonable name
can't be used.

<troll>
because real programmers like to be arcane and chose these names
to be cutesy...
</troll>

Bruno
 
D

Dan Pop

In said:
Well, actually, I'm against this practice. I don't see why a reasonable name
can't be used.

These names are typically used in contexts where no name is more
reasonable than another. So, instead of inventing some arbitrary name,
it's faster to resort to the popular generic names.
I think programmers like to be arcane and chose these names to be cutesy.

Being devoid of any meaning, they are ideal as generic identifiers.
I don't have a lot of time to try to figure out examples with
such names. I had never even thought about it until I read a letter in Dr.
Dobb's Journal stating what I just said.

Now those articles the letter writer was talking about were generally real
code used in example to a real situation. I can see where you might have a
function SO abstract that foo, bar, baz, etc. might be used. But an example
is supposed to explain something, so why are we making harder to understand?

Compare this to the following:

void foo (void)
{
int baz;
baz = bar (baz);
}

int bar (int tuti)
{
++tuti;
return (tuti);
}

You have chosen a bad example, the function bar actually performing
a meaningful operation. Quite often, this is not the case. Example:

int foo(void) { puts("foo"); return 1; }
int bar(void) { puts("bar"); return 1; }
int baz(void) { puts("baz"); return 1; }
...
foo() + bar() + baz();

is commonly used to point out that the actual order in which foo, bar and
baz are called is unspecified.

Dan
 
R

Richard Heathfield

ArWeGod said:
Well, actually, I'm against this practice. I don't see why a reasonable
name can't be used.

It /is/ a reasonable name, which illustrates very clearly and elegantly that
the choice of name was not significant.
Now those articles the letter writer was talking about were generally real
code used in example to a real situation. I can see where you might have a
function SO abstract that foo, bar, baz, etc. might be used. But an
example is supposed to explain something, so why are we making harder to
understand?

It's easier to understand an example if you can easily tell which bits are
there merely to satisfy the syntax, and which bits are supposed to be
exegetic. Hence the value of foo.
What's wrong with something like this instead:

void main (void)

The first void.
 
A

ArWeGod

Dan Pop said:
In <[email protected]> "ArWeGod"

These names are typically used in contexts where no name is more
reasonable than another. So, instead of inventing some arbitrary name,
it's faster to resort to the popular generic names.


Being devoid of any meaning, they are ideal as generic identifiers.


You have chosen a bad example, the function bar actually performing
a meaningful operation. Quite often, this is not the case. Example:

int foo(void) { puts("foo"); return 1; }
int bar(void) { puts("bar"); return 1; }
int baz(void) { puts("baz"); return 1; }
...
foo() + bar() + baz();

is commonly used to point out that the actual order in which foo, bar and
baz are called is unspecified.

Dan

Everyone,

The OP was asking for opinions. I gave mine. Give yours and shut up. I don't
care what you think, I was telling the OP what I think. Talk to the Mouse.

Dan,

You've restated my case, but in the negative. Let me start again.

In many example programs, the sample actually _does_ something. Yet, the
writer chooses to use the time-honoured foo, bar, etc. names. I find that
the example programs are NOT meaningless examples. This could be a flaw in
the author to come up with a generic but syntactically (sp?) correct
program, or whatever. It just usually ends up being something from their own
experience and has a function (if you will). For instance many Dr. Dobbs
Journal articles, where the examples are more "real - world" than some
posts; often an actual meaningful variable or function name would get the
point across, but they use meaningless terms. It's as if they want to "fit -
in" and be kewl. It tends to detract from the article, IMHO, and in the
opinion of the author of letter I am describing that changed my thinking.

I have no problem using foo, etc. if the example is TOTALLY generic. I just
don't see it much..

Flame ON!
 
I

Irrwahn Grausewitz

The Real OS/2 Guy said:

I did so:

- No match for "farz" in either german or english dict
- No match for "roedel" in either german or english dict

Maybe the words have a meaning in some other language I
and the mentioned dictionary do not know of.

I suggest /you/ use a dictonary before telling others to do so.

And, please, stop telling me nonsense, at least about my native
language. Thanks.

Irrwahn
 
T

The Real OS/2 Guy

I did so:

- No match for "farz" in either german or english dict
====
- No match for "roedel" in either german or english dict

I'd answerd the quote you'd quoted. Nobody can think you means
anything above the quote you'd written the answer under.
Maybe the words have a meaning in some other language I
and the mentioned dictionary do not know of.

I suggest /you/ use a dictonary before telling others to do so.

I'd done so, really, both word underlined are transated well.
 
I

Irrwahn Grausewitz

^^^^^^^^^^^ ^^^^^^^^^^^
Do you know the meaning of the words 'latter' and 'former'? See below.
I'd answerd the quote you'd quoted. Nobody can think you means
anything above the quote you'd written the answer under.
Then don't respond to *my* comment starting off with 'wrong ... ',
for C's sake!!!!
I'd done so, really, both word underlined are transated well.

*Nobody* doubted, and if you reread ///carefully/// you will notice
that we both agree that 'furz' and 'luder' are, albeit not nice,
german words!!!
 
J

Jirka Klaue

Irrwahn said:
....
*Nobody* doubted, and if you reread ///carefully/// you will notice
that we both agree that 'furz' and 'luder' are, albeit not nice,
german words!!!

"Roedeln" is not uncommon in German, even if some random dictionaries
don't know about it. ;-)

Jirka
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top