Messages look like another way of calling member functions (or are there other differences?).
The main difference that I've understood by practicing Obj-C is that messages can be sent to anyone – even if they don't understand them – unlike methods. But I'm not sure about that – and Apple often use methods and messages for the same thing so...
So you mean you can just do someObject someMessage, even if the object has no message named someMessage? I don't quite get how this is helpful.
ooc's syntax is alot cleaner than objective-c's
cleaner maybe, but not «a lot cleaner» – it's a quite different from what I've seen very quickly. In fact I looks more like Scala (in the Java way) than Obj-C to me.
Yep it is true that Objective-C and ooc don't have very much in common. However, every time i've seen Obj-C code, i turned my head and closed my eyes in horror.
I mean, how can you say that
o := MyObject new(myString)
is not alot cleaner than
MyObject *o = [[MyObject alloc] initWithString: myString];
However, they share some common aspects, like the way you can do foreach'es (yep, I know it is done in many other languages this way too)
for(cat in cats) {
...
}
Also ooc supports function suffixes, wich are, i believe, an obj-c feature (not sure about this). For example you can do taht in ooc:
MyClass : class {
init : func ~withString (str : String) { // Do something ... }
init : func ~withInt (num : Int) { // Do something ... }
}
Of course, when calling the funcion, you dont have to write the ~ part, wich is only here to help debugging and read the code. Always in this example, you could then do
obj1 := MyClass new("foo")
obj2 := MyClass new(42)
Note: new is actually not a keyword, but a static function wich is added by default to your class (it can be overwritten of course) and that calls init