foo bar是什么

文档中经常出现foo和bar,那到底foo bar是什么呢

 

 

 

     据说,最初中国雕像底部刻有表示“福”一类的图形和文字,通过音译 "Fu" 就变成了 "Foo",然后一个漫画作家经常把这个词用在漫画中,比如用在漫画背景中不表示什么具体的意义,再后来二战时 "Foo" 成了美英两军的常用词,也有说此时的 "Foo" 来源于法语“火”的音译。

    Foo 和 Bar 来自二次世界大战美军间的口头禅 FUBAR (f**ked Up Beyond All Repair) (注:电影雷霆救兵里士兵便经常说着 FUBAR),后来演变成 foo 和 bar,最常见于 API 和 Tech Doc 上,作为没特别意思的变量和函数而设的名字 (PHP 上可见不少)。而 Internet Engineering Task Force 也有为 foo 和 bar 而设 RFC(Request For Comment,大部份是 Internet 协议和标准的技术文章,好像 HTTP,SMTP 等等)。这份 RFC 内容在说 Foo 和 Bar 的历史,变异,以及现时应用 foobar 的 RFC 等。

    其实说白了, foo就是在文档中是一个随意的名字而已,就象我们在讲故事的时候习惯于用“张三”代替一个名字不重要的人。

 

--------------------------------------------   
  foo   /foo/  
  1.   interj.   Term   of   disgust.  
  2.   [very   common]   Used   very   generally   as   a   sample   name   for   absolutely   anything,   esp.   programs   and   files   (esp.   scratch   files).

----------------------------------------------

FooBar is a classic name in program examples, documentation etc (AmericanCulturalAssumption?). Some have been of the opinion that it's a cleaned up version of its cousin FuBar, but this seems unlikely; its etymology appears to be quite different. The canonical sources of information about this are the JargonFile at http://www.catb.org/~esr/jargon/html/F/foo.html and RFC 3092 (at numerous locations, one of which is http://www.faqs.org/rfcs/rfc3092.html.)

----------------------------------------------
foobar这个定义名词来自于行话,当你需要一个名字但是又不知道怎么起的时候常用来做元语法变量(你在Google搜索foobar可以看到它是个临时的变量)。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值