经常看到'foo'=>'bar'这种举例,前面那个词什么意思呢?

经常看到'foo'=>'bar'这种举例,前面那个词什么意思呢?
bar有酒吧的意思,前面foo什么意思呢,
我想问的是,为什么举例的时候总是用这两个不知道要表达什么意思的词。

阅读 6.8k
4 个回答

没有什么特殊含义。

本身是foobar,通常被拆开来用,但并没有什么含义。通常用来写一些案例的时候会用上,其实和用a,b,c之类命名没有什么区别。

在计算机程序设计与计算机技术的相关文档中,术语foobar是一个常见的无名氏化名,常被作为“metasyntactic variable”使用1

A metasyntactic variable is a placeholder name used in computer science, a word without meaning intended to be substituted by some objects pertaining to the context where it is used. The word foo as used in IETF Requests for Comments is a good example2.

foobar:

[very common] Another widely used metasyntactic variable; see foo for etymology. Probably originally propagated through DECsystem manuals by Digital Equipment Corporation (DEC) in 1960s and early 1970s; confirmed sightings there go back to 1972. Hackers do not generally use this to mean FUBAR in either the slang or jargon sense. See also Fred Foobar. In RFC1639, “FOOBAR” was made an abbreviation for “FTP Operation Over Big Address Records”, but this was an obvious backronym. It has been plausibly suggested that “foobar” spread among early computer engineers partly because of FUBAR and partly because “foo bar” parses in electronics techspeak as an inverted foo signal; if a digital signal is active low (so a negative or zero-voltage condition represents a "1") then a horizontal bar is commonly placed over the signal label3.


  1. https://en.wikipedia.org/wiki/Foobar
  2. https://en.wikipedia.org/wiki/Metasyntactic_variable#cite_note-RFC3092-1
  3. http://www.catb.org/jargon/html/F/foobar.html

大概就等于甲和乙

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
宣传栏