Why do Objective-C files use the .m extension?

Objective CFile Extension

Objective C Problem Overview


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?

Objective C Solutions


Solution 1 - Objective C

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 [...]"

(from the book "Learn Objective-C on the Mac" by Mark Dalrymple and Scott Knaster, page 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:

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

Here's the email as visual proof:

Visual Proof

Solution 2 - Objective C

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

> 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.

Solution 3 - Objective C

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKuba SuderView Question on Stackoverflow
Solution 1 - Objective CsplattneView Answer on Stackoverflow
Solution 2 - Objective CAdam RosenfieldView Answer on Stackoverflow
Solution 3 - Objective Cbaker1990View Answer on Stackoverflow