Hacker News new | past | comments | ask | show | jobs | submit login

Not just that, I also just don't understand the point.

" a small C library which implements high-level concepts available in Clos, Objc"

Well, Objective-C is "a small C library" which implements the high-level concepts available in Objective-C. Mostly. At some point, the creators found out that they needed a "compiler" to gather up and unique selectors, and at that point adding a small amount of syntactic sugar was easy and useful.

An object is a struct with pointer to a class as its firs element. (A class is another struct, it is also an object) And 'id' is a pointer to such an object.

A selector (SEL) is a uniqued C-String.

A method is a C function that takes an object and a selector as its first arguments:

    -hi:there {
    }
is roughly the same as

    id hi( id self, SEL _cmd, id there ) {

    }
(The naming is slightly different)

Sending a message is calling the function objc_msgSend(). And if you don't like the syntactic additions, just call objc_msgSend() yourself.

Those who don't understand Objective-C are doomed to reinvent it?




Yes, it seemed strange to me as well. "We really, really like Objective-C and decided to poorly implement it in C". Just use Objective-C! It's perfectly compatible with C, it has better syntax and better compilers with better error messages. This is just crazyness.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: