Welcome, Guest. Please login or register.

Author Topic: Native Objective-C compiler available  (Read 3965 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline crystall

  • Newbie
  • *
  • Join Date: Nov 2003
  • Posts: 32
    • Show all replies
Re: Native Objective-C compiler available
« on: November 25, 2003, 10:27:30 AM »
It's an object-oriented programming language based on C which was developed by NEXT and was widely used in NEXTSTEP. Now it is a popular language on NEXTSTEP derivatives/clones like OpenStep or MacOS X. Personally I find it a much cleaner OO extension to C than C++.
 

Offline crystall

  • Newbie
  • *
  • Join Date: Nov 2003
  • Posts: 32
    • Show all replies
Re: Native Objective-C compiler available
« Reply #1 on: November 25, 2003, 12:10:18 PM »
You can find a fairly good guide on Apple's developer site at this link: Objective-C
 

Offline crystall

  • Newbie
  • *
  • Join Date: Nov 2003
  • Posts: 32
    • Show all replies
Re: Native Objective-C compiler available
« Reply #2 on: November 26, 2003, 12:56:22 AM »
Quote
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.

Quote
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++) 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.
 

Offline crystall

  • Newbie
  • *
  • Join Date: Nov 2003
  • Posts: 32
    • Show all replies
Re: Native Objective-C compiler available
« Reply #3 on: November 26, 2003, 01:06:15 AM »
Quote
C++ Rocks. etc...

What you say is certainly true, C++ sports a lot of features which other languages miss and you list them completely. Some are nice, the first time I tried operator overloading I fell in love with it. The problem is that when you start working on other people's code you realize why Java, Objective-C and other OO languages have been invented: the syntax is a mess. Operator overloading is cool, but if you don't know exatly what the programmer meant for a particular operator it can be awkward to use. Dynamic and static calls are the same, you cannot notice a difference between the two from the syntax and a dynamic call can be very slow. Multiple inheritance is nice as long as you know exactly what's going on in your code. If you don't because you are extending classes written by others it can reserve you some really bad surprises. On top of that references don't make any sense to me, they look like they have been introduced just for solving problems of the language (like the copy constructor).
 The only thing which still makes me use the language for some purposes is template programming which is a really nifty feat. I hope that it'll be introduced in Java 1.5.
 

Offline crystall

  • Newbie
  • *
  • Join Date: Nov 2003
  • Posts: 32
    • Show all replies
Re: Native Objective-C compiler available
« Reply #4 on: November 27, 2003, 05:06:21 PM »
Quote
But how do you know whether a simple function call doesn't make use, in turn, of a dynamic call?


You cannot obviously but Obj-C is usually used to build up OO application / frameworks using C at the lower levels so it is highly unlikely to have a function call a method. It kind of reverses the whole OO paradigm :)