FOO 究竟是什么意思?

经常在书上的例子里面看见 foo 这个方法名称,一直不知道这个单词是什么意思,不过猜测,应该相当于A,B,C,D..甲、乙、丙、丁...之类的意思,今天特意去查询一下:

[url]http://searchcio-midmarket.techtarget.com/sDefinition/0,,sid183_gci212139,00.html[url]

[b]foo [/b]

[quote]Just as economists sometimes use the term "widget" as the ultimate substitute for "something" that is being measured, [color=red]programmers tend to use the term "foo" (pronounced FOO) as a universal substitute for something real when discussing ideas or presenting examples. [/color]Suppose you are defining a template for any group of programmers to follow when creating a new user command, you might specify that the syntax for the command should be in the form:
Command foo (arg1, arg2)

where the "foo" would mean "the name you give to this command." In other words, "foo" is a nonsense kind of placeholder for some value that will be provided when using this template to define a real command. (And the "arg1" and "arg2" are arguments or information you would define that would be passed along with the command.) Because "foo" has no rational meaning of its own and because "foo" is conventionally used as such a placeholder, the idea will be clear to any programmer.
Foo or any such word used this way is formally known as a metasyntactic variable. Eric Raymond, probably the world's greatest authority on foo and other metasyntactic variables, also lists qux, waldo, fred, xyzzy, and thud among others that are occasionally used. Although foo is the canonical metasyntactic variable, Raymond notes that cultures outside the United States have their own preferences. Fred, barney, and wombat seem common in the U.K. Toto, tata, titi, and tutu reportedly are used by the French. Blarg and wibble are used in New Zealand.

The origin of foo seems wrapped in the mists of time, but Raymond observes (and we remember) that in Bill Holman's comic strip of the 1930-50 era, Smokey Stover, the letters "FOO" commonly appeared, unexplained and as a kind of running gag, on license plates, in picture frames, and on the backs of sandwich board signs.

Also see FUBAR.


CONTRIBUTORS: Kevin Barrett and R. Terry McCutchen
LAST UPDATED: 14 Dec 2006
[/quote]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值