Welcome, Guest. Please login or register.

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

Description:

0 Members and 1 Guest are viewing this topic.

Offline falemagnTopic starter

  • Sr. Member
  • ****
  • Join Date: May 2002
  • Posts: 269
    • Show only replies by falemagn
    • http://www.aros.org/
Native Objective-C compiler available
« on: November 25, 2003, 10:10:11 AM »
It compiled out of the box, and appears to function properly, although I didn't have that many ObjC programs to test it with, so beware and pay the usual attention you pay with beta software.

If you're interested, you can find it here: http://www.aros.org/downloads/gcc-objc-3.3.1-aros.tar.bz2

Just unpack it in the same directory where you unpacked the gcc/g++/binutils archive, and then you're ready to start compiling Objective-C stuff.

Enjoy :-)
 

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show only replies by bloodline
    • http://www.troubled-mind.com
Re: Native Objective-C compiler available
« Reply #1 on: November 25, 2003, 10:13:45 AM »
Maybe this is a weird question... But what is Objective-C? :-D

Offline falemagnTopic starter

  • Sr. Member
  • ****
  • Join Date: May 2002
  • Posts: 269
    • Show only replies by falemagn
    • http://www.aros.org/
Re: Native Objective-C compiler available
« Reply #2 on: November 25, 2003, 10:21:12 AM »
Quote
Maybe this is a weird question... But what is Objective-C?


Ehm... a programming language?! :-)

Look here for more info.
 

Offline crystall

  • Newbie
  • *
  • Join Date: Nov 2003
  • Posts: 32
    • Show only replies by crystall
Re: Native Objective-C compiler available
« Reply #3 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 bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show only replies by bloodline
    • http://www.troubled-mind.com
Re: Native Objective-C compiler available
« Reply #4 on: November 25, 2003, 10:33:46 AM »
Quote

crystall wrote:
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++.


Oh? I must have a look...


Cheers for the link Fabio ;-)


Offline crystall

  • Newbie
  • *
  • Join Date: Nov 2003
  • Posts: 32
    • Show only replies by crystall
Re: Native Objective-C compiler available
« Reply #5 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 bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show only replies by bloodline
    • http://www.troubled-mind.com
Re: Native Objective-C compiler available
« Reply #6 on: November 25, 2003, 12:36:03 PM »
Quote

crystall wrote:
You can find a fairly good guide on Apple's developer site at this link: Objective-C


I hae only just got to grips with C++.. Object-C makes my head spin  :crazy:

Offline minator

  • Hero Member
  • *****
  • Join Date: Jan 2003
  • Posts: 592
    • Show only replies by minator
    • http://www.blachford.info
Re: Native Objective-C compiler available
« Reply #7 on: November 25, 2003, 02:34:41 PM »
Quote
I hae only just got to grips with C++.. Object-C makes my head spin  


Objective-C is meant to be very nice, never used it myself but I've never heard any complaints about it.

I've never heard anything but complaints about C++!

IIRC The syntax is a lot closer to Java.
 

Offline falemagnTopic starter

  • Sr. Member
  • ****
  • Join Date: May 2002
  • Posts: 269
    • Show only replies by falemagn
    • http://www.aros.org/
Re: Native Objective-C compiler available
« Reply #8 on: November 25, 2003, 02:58:33 PM »
Quote
Objective-C is meant to be very nice, never used it myself but I've never heard any complaints about it.


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.

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! :-)

Quote
I've never heard anything but complaints about C++!


Well, C++ isn't perfect, but it has its enormous advantages over ObjC.

Quote
IIRC The syntax is a lot closer to Java.


Not really, Java's syntax is practically the same as C++'s one.
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show only replies by Karlos
Re: Native Objective-C compiler available
« Reply #9 on: November 25, 2003, 09:18:25 PM »
Quote

minator wrote:

I've never heard anything but complaints about C++!


Well, now you will hear differently...

C++ Rocks. It is the Uber systen level programming language, offering all things to all people. Most of the complaints I hear are down to the use of bad or outdated implementations or from people stuck into a totally entrenched way of thinking when it comes to programming paragdims (tosa ksereis tosa les ;-))

Don't care for OOP? Well, C++ compiles all good C clean code. You can make incremental improvements to old C code without totally changing it to OOP, take advantage of stricter type checking, better dynamic allocation etc. etc.

Love OOP? C++ offers the most flexible inheritance methods, far more potent than Java's miserable excuse for inheritance. You can use true multiple inheritance, you can ensure a given class is only inherited once in a heirarchy etc.

Only java programmers and heavily inbred people see singular inheritance as good genetics.

Want to use operator syntax in your class definitions? Not a problem. Try that in proper java...

Dont like inheritance as a primary means of extending properties? Bugger it, you can do compositional structuring too if thats what you prefer. Its easy to do runtime class composition using composition patterns.

Love dynamic type checking? Thats what RTTI is for.

Like garbage collection? Smart pointer libraries exist that can delete objects no longer referenced for people too scared to look after resources themselves.

Don't like automated garbage collection? Me neither as a rule (handy sometimes though) . Real wo/men of genius write proper virtual destructors and delete what the dont need when it is time to do so.

Too lazy to write classes for different implementations of a concept? Use templates and let the compiler create the various class dependent implementations of a template for you.

Don't like the templates generated for particular classes? Write specializations for those.

Theres countless other things I can't be bothered to mention. C++ gives C runtime efficiency (for well written code) and gives the best OOP flexibility of any language.

Bjaarne Straustrup, we salute you :-)
int p; // A
 

Offline crystall

  • Newbie
  • *
  • Join Date: Nov 2003
  • Posts: 32
    • Show only replies by crystall
Re: Native Objective-C compiler available
« Reply #10 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 only replies by crystall
Re: Native Objective-C compiler available
« Reply #11 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 Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show only replies by Karlos
Re: Native Objective-C compiler available
« Reply #12 on: November 26, 2003, 01:06:27 AM »
No amount of medhod address cacheing is ever going to be as fast as a normal C++ virtual function call unless the first entry in the cache is the one you need.

On any decent C++ implementation a virtual call is simply fetching a function address from a table referenced by the object you are invoking the method on.

That is at most two, statically indexed pointer dereferece steps.

The only time it is genuinely slow is if it causes some OS mechanism to kick in, such as a VM page miss or something.
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show only replies by Karlos
Re: Native Objective-C compiler available
« Reply #13 on: November 26, 2003, 01:13:18 AM »
@Crystal

I am not disputing that C++ has lots of gripes and confusing code can be written when its feature set is misued.

I am just attempting to present C++ in a more positive bias - I always hear people griping about the same old things, not one of which is really the languages fault.

If a programmer decides ot overload operator+ to do a multiplication for a class, is that the languages fault or the programmers?

Is a bad inheritance tree the languages fault, or again the programmers?

I dont find C++ syntax that bad, but agree it is odd in places.

I do find however, that java etc simply restrict the options which punishes good developers to keep the bad ones in line.
int p; // A
 

Offline falemagnTopic starter

  • Sr. Member
  • ****
  • Join Date: May 2002
  • Posts: 269
    • Show only replies by falemagn
    • http://www.aros.org/
Re: Native Objective-C compiler available
« Reply #14 on: November 26, 2003, 01:23:59 AM »
Quote

crystall wrote:
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.


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.

Quote

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

Well, you simply need to put the class' name before the method's name. Not really that big difference.

Quote
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?