为什么Objective C文件使用.m扩展名?

时间:2022-06-14 20:07:21

Since I started learning Objective C and Cocoa, I've been wondering why they have chosen the extension .m for the implementation files - was it supposed to mean something, or was it just a random letter? Does anyone know? I couldn't find such information anywhere on Google...

自从我开始学习Objective C和Cocoa以来,我一直在想他们为什么选择扩展.m作为实现文件——它应该是什么意思,还是只是一个随机的字母?有人知道吗?我在谷歌的任何地方都找不到这样的信息……

4 个解决方案

#1


413  

Today most people would refer to them as "method files", but

今天,大多数人会把它们称为“方法文件”,但是。

"The .m extension originally stood for "messages" when Objective-C was first introduced, referring to a central feature of Objective-C [...]"

当Objective-C第一次被引入时,“.m扩展”最初代表“消息”,指的是Objective-C的一个中心特性[…]

(from the book "Learn Objective-C on the Mac" by Mark Dalrymple and Scott Knaster, page 9)

(从《学习Objective-C》中Mark Dalrymple和Scott Knaster,第9页)

EDIT: To satisfy an itch I emailed Brad Cox, the inventor of Objective-C, about the question and he answered with this single line:

编辑:为了满足一个渴望,我给Objective-C的发明者布拉德·考克斯(Brad Cox)发了一封电子邮件,问他关于这个问题的问题,他回答说:

"Because .o and .c were taken. Simple as that."

因为。o和。c被拿走了。就这么简单。”

Here's the email as visual proof:

这是电子邮件的视觉证明:

为什么Objective C文件使用.m扩展名?

#2


8  

It stands for "methods". From the comp.lang.objective-C FAQ:

它所代表的“方法”。从comp.lang。objective - c常见问题解答:

The organisation of Objective-C source is typically similar to that of C or C++ source code, with declarations and object interfaces going into header files named with a .h extension, and definitions and object implementations going in files named with a .m (short for methods) extension.

Objective-C源的组织通常类似于C或c++源代码,声明和对象接口进入以.h扩展名命名的头文件,以及以.m(方法)扩展名命名的文件中的定义和对象实现。

#3


4  

.m files contain the (m)ethods. Possible reason?

.m文件包含(m)ethods。可能的原因?

#4


0  

Wild guess: 1983 was ObjectC introduced along with the first Macintosh computer... . So it might be m as in macintosh or m as in methods or even both.

疯狂猜测:1983年是ObjectC和第一台Macintosh电脑一起推出的……。所以它可能是m,在麦金塔或m,在方法上,甚至是两者。

#1


413  

Today most people would refer to them as "method files", but

今天,大多数人会把它们称为“方法文件”,但是。

"The .m extension originally stood for "messages" when Objective-C was first introduced, referring to a central feature of Objective-C [...]"

当Objective-C第一次被引入时,“.m扩展”最初代表“消息”,指的是Objective-C的一个中心特性[…]

(from the book "Learn Objective-C on the Mac" by Mark Dalrymple and Scott Knaster, page 9)

(从《学习Objective-C》中Mark Dalrymple和Scott Knaster,第9页)

EDIT: To satisfy an itch I emailed Brad Cox, the inventor of Objective-C, about the question and he answered with this single line:

编辑:为了满足一个渴望,我给Objective-C的发明者布拉德·考克斯(Brad Cox)发了一封电子邮件,问他关于这个问题的问题,他回答说:

"Because .o and .c were taken. Simple as that."

因为。o和。c被拿走了。就这么简单。”

Here's the email as visual proof:

这是电子邮件的视觉证明:

为什么Objective C文件使用.m扩展名?

#2


8  

It stands for "methods". From the comp.lang.objective-C FAQ:

它所代表的“方法”。从comp.lang。objective - c常见问题解答:

The organisation of Objective-C source is typically similar to that of C or C++ source code, with declarations and object interfaces going into header files named with a .h extension, and definitions and object implementations going in files named with a .m (short for methods) extension.

Objective-C源的组织通常类似于C或c++源代码,声明和对象接口进入以.h扩展名命名的头文件,以及以.m(方法)扩展名命名的文件中的定义和对象实现。

#3


4  

.m files contain the (m)ethods. Possible reason?

.m文件包含(m)ethods。可能的原因?

#4


0  

Wild guess: 1983 was ObjectC introduced along with the first Macintosh computer... . So it might be m as in macintosh or m as in methods or even both.

疯狂猜测:1983年是ObjectC和第一台Macintosh电脑一起推出的……。所以它可能是m,在麦金塔或m,在方法上,甚至是两者。