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

后端 未结 4 1319
-上瘾入骨i
-上瘾入骨i 2020-12-04 06:22

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,

4条回答
  •  北海茫月
    2020-12-04 07:00

    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

提交回复
热议问题