crystall wrote:
Ok, here's one: it's slow. ObjC has dynamic typechecking and methods invocation is achieved via something akin AmigaOS' BOOPSI dispatchers, with the exception that ObjC dispatching can be a lot slower due to the fact that the "methodid" is the hash value of the method name, and computing hash values is slow.
This depends heavily on implementation, dynamic method calls in C++ can be just as slow. AFAIK Apple's implementation of Objective-C is very fast, basically the system keeps a cache of dynamic method calls to avoid to recalculate each and every time hash values, it works pretty well.
Yes, well, a simple caching mechanism is the least I'd expect from any objc runtime implementation, and it's the same technique implemented by gcc's runtime, however a method invocation is still about 3 times slower, in the average case, than a C++ virtual call (I'm citing some benchmarks I read about some time ago on the net).
In any case, where speed is not everything, I agree ObjC has its usage. It could be used for GUI stuff, for instance, and there the dynamic method dispatching and typecheckign can have its usages as well.
Add to that the strange syntax, completely foreign to the C syntax, it uses for classes interfaces/implementations and methods invocation, and you get another complaint. Whooo, we've got already two of them!
Yeah, that can be a problem, Obj-C syntax was borrowed from smalltalk so you can like it or hate it. Personally, having used BOOPSI a lot (which is quite influenced by smalltalk IMHO) I find it nice. Apart from class/methods definition (which are different from plain C even in C++)
Well, you simply need to put the class' name before the method's name. Not really that big difference.
the only addition to the language is the method call which is much different from a C function call and thus makes it pretty clear where you are using dynamic calls and where you're not.
But how do you know whether a simple function call doesn't make use, in turn, of a dynamic call?