我希望这是一个编程问题,因为在任何编程教程中,您最终都会在代码示例中遇到'foo'。(是吗?)
foo到底是什么意思?
如果它本来毫无意义,那么它是什么时候开始被这样使用的呢?
我希望这是一个编程问题,因为在任何编程教程中,您最终都会在代码示例中遇到'foo'。(是吗?)
foo到底是什么意思?
如果它本来毫无意义,那么它是什么时候开始被这样使用的呢?
当前回答
Foo用作占位符名称,通常在示例代码中表示所命名的对象或名称的选择不是示例的关键部分。Foo后面通常跟着bar、baz,如果需要多个这样的名称,甚至还有bundy。维基百科称这些名称为元异步变量。Python程序员应该使用spam, eggs, ham,而不是foo等。
foo在SA中有很好的用途。
我也见过程序员在想不出一个有意义的名字(比如tmp的替代品)时使用foo,但我认为这是对foo的误用。
其他回答
我觉得这意味着什么都没有。维基上说:
Foo通常与元异步变量bar和foobar一起使用。
它是一个元异步变量。
“Foo”的定义有很多含义:
bar, and baz are often compounded together to make such words as foobar, barbaz, and foobaz. www.nationmaster.com/encyclopedia/Metasyntactic-variable Major concepts in CML, usually mapped directly onto XMLElements (to be discussed later). wwmm.ch.cam.ac.uk/blogs/cml/ Measurement of the total quantity of pasture in a paddock, expressed in kilograms of pasture dry matter per hectare (kg DM/ha) www.lifetimewool.com.au/glossary.aspx Forward Observation Officer. An artillery officer who remained with infantry and tank battalions to set up observation posts in the front lines from which to observe enemy positions and radio the coordinates of targets to the guns further in the rear. members.fortunecity.com/lniven/definition.htm is the first metasyntactic variable commonly used. It is sometimes combined with bar to make foobar. This suggests that foo may have originated with the World War II slang term fubar, as an acronym for fucked/fouled up beyond all recognition, although the Jargon File makes a pretty good case ... explanation-guide.info/meaning/Metasyntactic-variable.html Foo is a metasyntactic variable used heavily in computer science to represent concepts abstractly and can be used to represent any part of a ... en.wikipedia.org/wiki/FOo Foo is the world of dreams (no its not) in Obert Skye's Leven Thumps series. Although it has many original inhabitants, most of its current dwellers are from Reality, and are known as nits. ... en.wikipedia.org/wiki/Foo (place) Also foo’. Representation of fool (foolish person), in a Mr. T accent en.wiktionary.org/wiki/foo
资源:谷歌
参见RFC 3092:“Foo”的词源,D. Eastlake 3rd等。
为简洁起见,只引用RFC中的相关定义:
通常用作任何事物的示例名称,尤指 程序和文件(特别是草稿文件)。
中使用的元异步变量的标准列表中的第一个 语法示例(bar, baz, qux, quux, corge, grault, garply, 沃尔多,弗雷德,噗,xyzzy,砰)。(术语)
In my opinion every programmer has his or her own "words" that is used every time you need an arbitrary word when programming. For some people it's the first words from a childs song, for other it's names and for other its something completely different. Now for the programmer community there are these "words" as well, and these words are 'foo' and 'bar'. The use of this is that if you have to communicate publicly about programming you don't have to say that you would use arbitratry words, you would simply write 'foo' or 'bar' and every programmer knows that this is just arbitrary words.