You're not getting my point though - if you saw C++ and Objective-C at the same time, both completely new to you, C++ would look more like C. This isn't just a subjective thing.
This is how you call a function in C:
myFunc(a, b, c);
This is how you call a method in C++:
obj.myMethod(a, b, c);
But in Objective-C:
[obj myMethod: a andB: b andC: c];
Clearly, C++ looks more like C - not just because that's what we know, but because it's empirically true.
Now, you think it's impossible to make a preprocessor tell the difference between C++ and C (that is, if you were to extend C into C++ using a preprocessor). So since you're so sure, I will show you how it's done:
The class declarations are easy - find 'class' keyword - so everything between the curly braces is something that needs preprocessing.
The important part is method calls. So, lets say we have this: obj.myMethod(1, 2, 3);
How do you tell this is a method call to process?
Well start by tokenizing obviously, and work through the tokens, adding them to a parse tree.
So far we have this parse tree:
So far this would be perfectly valid in C - it can just be re-assembled as 'obj.myMethod'. But then you find a '('. This tells you that the 'dot' isn't a field access, but actually a method call, so you can change it to something like this:
->
/ \
obj myMethod
/ | \
1 2 3
Now, when re-assembling it, you find a '->' instead of a '.'. This tells the preprocessor not to make it so a standard field access, but make it a function call, such as: MyClass_myMethod(obj, 1, 2, 3);
It's not difficult to do this stuff. The decision to make it look how it looks was a purely aesthetic one (perhaps to make it look more like SmallTalk) - not because they couldn't. And that's what I don't like - they wanted to extend C by mixing it with a totally different language.
"everyone forgets a semi-colon sometimes." - Phaelax