知识点滴 - Foo, bar和slang

本文探讨了编程术语Foobar的含义,它起源于军事俚语,用于编程中的占位符,常用于命名变量和函数。介绍了其在计算机科学中的使用背景,以及TMRC在MIT的首次印刷使用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Foobar本身是一个俚语或俗语,英文里叫做slang。

slang

a type of language that consists of words and phrases that are regarded as very informal, are more common in speech than writing, and are typically restricted to a particular context or group of people.

一种由被认为是非常非正式的单词或短语组成的语言类型,更常见于口语, 少见于书面语,通常仅限于特定的语境或人群。

Foobar的介绍如下:

术语foobar(/ˈfuːbɑːr/)在计算机编程或计算机相关文档中被用作元语法变量和占位符名称。它们被用来命名实体,如变量、函数和命令,其确切身份并不重要,只是为了展示一个概念。

The terms foobar (/ˈfuːbɑːr/) are used as metasyntactic variables and placeholder names in computer programming or computer-related documentation.[1] They have been used to name entities such as variables, functions, and commands whose exact identity is unimportant and serve only to demonstrate a concept.

Foobar有可能是对二战时期军事俚语FUBAR(Fucked Up Beyond All Recognition)的俏皮暗示,意思是事情搞得一团糟,都面目全非了。

或者是二战时美军里有的说法:Fouled(Fucked) up beyond all repair,表示情况或东西已经被搞坏了,没法挽救了。

Fouled up beyond all repair (FUBAR) is a slang term that originated and was popularized during World War II by American soldiers. The term means that a situation or object is so messed up that it is beyond being salvageable.

第一个已知的在编程背景下的印刷品使用出现在1965年的麻省理工学院的《技术工程新闻》中。在编程时使用foo通常归功于麻省理工学院的技术模型铁路俱乐部(TMRC),大约在1960年。

所以,我们经常在一些编程例子中看到foo,bar这些词汇用作函数或变量名。

参考:

https://en.wikipedia.org/wiki/Foobar

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

夜流冰

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值