Welcome, Guest. Please login or register.
Amiga Kit Amiga Store Iridium Banner AMIStore App Store A1200/A600 4xIDE Interface

AuthorTopic: Native Objective-C compiler available  (Read 2321 times)

0 Members and 1 Guest are viewing this topic.

Offline Rodney

Re: Native Objective-C compiler available
« Reply #15 on: November 26, 2003, 02:44:21 AM »

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.

I was never a big fan of java untill i used it. As a language it hink its pretty nifty, but i think once you compile you'r apps you've got performance to worry about in a big way.

I remember no one could get me to understand OOP and then i read one paragraph of learn C++ in 24 hours. I believe it was chapter 7 and it basicly related a class to a struct.

I think i may still prefer C++, although i believe i know less aobut it, even havign coded far more C++ than Java. But the one think i like about C++ and C obviously is pointers... I was porting a C application ones to Java, i first made it OO and did a few other things and since Java didnt really support pointer, i turned my pointers into one dimensional arrays :)

hehe... stupid java

EDIT - Oh yer, operator overloading :) gime some of that!!

Thats right, i cant contribute anything towards this topic :)
We are not Humans having a spirital experiance
We are Spirits having a Human experiance.

Offline Karlos

Re: Native Objective-C compiler available
« Reply #16 on: November 26, 2003, 03:08:52 AM »
The niftiest thing in java for me is the way it handles threads.

A simple Thread class / Runnable interface pair itself is no big deal at all in C++ provided you know your target OS.

However, java's inbuilt support goes further than that. Access specifiers such as synchronized etc. are damn cool.

I also like the 'final' qualifier. For objects the 'constant after first assigned at runtime' is pretty neat, and for methods as an override inhibitor its quite cool too.

One thing I would like to see in any of these languages is an access specifier that makes member objects of a class 'read only' to the outside world, but behaves as read/write within the class itself. So much better than writing getSomething() methods for everything, dontcha think?

I did once play around with a template for this idea but it's not quite possible in the way I envisaged.
int p; // A

Offline crystall

Re: Native Objective-C compiler available
« Reply #17 on: November 27, 2003, 05:06:21 PM »
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 :)

Offline Karlos

Re: Native Objective-C compiler available
« Reply #18 on: November 27, 2003, 06:02:49 PM »
Maybe I misunderstood you, but you can have functions that arent part of a class call other classes' methods in plenty of legitimate OOP uses.

Consider, in C++, something like

Vector3D operator*(Vector3D& v, TransformMatrix& m);

Such a function cannot be a member of either class, but need to invoke methods of both.
int p; // A

Offline Cymric

Re: Native Objective-C compiler available
« Reply #19 on: November 28, 2003, 01:28:16 AM »
Karlos wrote:
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 ;-))

Ooooo... Bold statement, there. While I agree to a certain extent with you, and also realise that you wrote the text to promote rather than criticise C++, I cannot resist adding a few 'ifs and buts' for the sake of objectivism. (Is that a proper word?)

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.

This is just 'syntactic candy' which most good C-compilers already offer as an extension to standard ANSI-C. Useful, but on the other hand your programs will not compile using a regular C compiler anymore since the features they rely on are different in C and C++. Bottom line: If your program is in C, don't use a C++-compiler to compile it.

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.

C++'s object model is probably so succesful because it is so weak and allows the programmer to do everything. It's probably like C being not much more than assembly with a readable, if somewhat cryptic syntax. The discussion regarding single and multiple inheritance has passed beyond the qualification 'Holy War'. My opinion? Stick to single inheritance for as long as you can. Why? Simpler inheritance, cleaner OO model, and less chance of you shooting yourself in the foot as the amount of classes and objects begins to grow. In defense of multiple inheritance, I will say that I think the language should support it. Java's way, however elegant, requires the programmer to duplicate code unnecessarily, which is not a Good Thing.

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

Operator syntax is a nightmare if you didn't write the code you're supposed to be extending/maintaining/whatever. It's a feature which I think was added 'because we can': in most cases it is completely equivalent to using a normal, standard, human-readable function name. Sort-of-like C's ?: operator. To add insult to injury, most overloadable operators do not make intuitive sense with custom objects. Obfuscation at its worst.

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.

Eh?? Compositional structuring? What's that?

Love dynamic type checking? Thats what RTTI is for.

Indeed it is. But it isn't limited to C++. Any language with reflective capabilities can do this.

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.

Erm... Real wo/men probably do not need to work with other people's libraries as they write their own all the time, right? There are times when it is next to impossible to do manual memory management in an OO environment without causing memory leaks or major performance loss. In simple applications, DIY is probably more efficient, true. In big programs, use GC. It'll save hair and money. (Since you don't have to buy aspirin :-).) Speaking of GC, the technique has evolved over time. Collectors are now quite efficient; there really is no need to shy away from a proper GC implementation. Even for a tiny little program.

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.

Yep, nice feature. Until you encounter type promotion rules to figure out what instance of your template is called. Which is not fun, since noone can remember C++'s type promotion rules. Many implementations of templates are buggy and not very efficient too, so I'm not really sure whether templates are a Good Thing in practice.

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.

While I have little experience with coding in C++, I don't think that last statement is correct.  Unless you mean 'flexibility' by allowing every strict OO rule to be bypassed and excepted. Take this link, for example. You may find it interesting to see where exactly C++ is doing things which are strange and odd to say the least. (And that the little-known Eiffel is better at handling OO than is C++.)

 Of course I pretended to be the devil's advocate. There's plenty of examples where C++ delivers solid performance through elegant code. However, there is also plenty of opportunity to give in to 'The Dark Side of the Force', and you can legitimately wonder whether that is the language's or the programmer's fault. In the end, I feel that if you know about and accept the pitfalls, you can easily avoid them, and make sure you emerge relatively unscathed in case you have to walk into one.

Some people say that cats are sneaky, evil and cruel. True, and they have many other fine qualities as well.

Offline Karlos

Re: Native Objective-C compiler available
« Reply #20 on: November 28, 2003, 02:34:50 AM »

As I already pointed out, I keep seeing the same old gripes about C++, Of those, 99% are down to things which are ultimately the programmers fault and not the languages.

C++ remains the most powerful and flexible language for writing code, IMHO. Just because you can mix paragdims doesn't make it something to be shied away from. C++ has never, ever pretended to be a pure OOP language, so slamming it for not being pure OOP is unfair.

About the flexibility issue. None of the features I mentioned are really brekaing the OOP rules, aside from compiling some old C code in C++.

Having functions not associated with classes isnt even breaking good OOP as long as you know when to use such things - see my earlier post about the operator overload for multiplying two different classes (a vector3d and matrix).

Operator overloading, multiple inheritence etc are not bad OOP. Using them badly, is bad OOP. emoving them altogether is just annoying and frustrating.

Bad misuse of a language is not the languages fault, but the programmers. I can write some absolutely awful java code too if I wanted to.

Just because they took out features to make it 'stricter' and more 'idiot proof' doesnt mean that it is a better language. it is just a simpler one.

PS : Oh yeah - compositional structuring. It's an alternative way of sharing properties between classes other than by inheritence. Instead of inheriting a class, you embed a reference (a pointer usually) to an object of the class who's properties you want to use.

Within your class you define methods (genrally simple inlines) that simply invoke the corresponding methods of the object you embedded.

Design patterns such as the 'delegation' etc. tend to use this.

Since the reference you embed can be (and usually is, since this is the intent of this design pattern) to a polymorphic class, what you basically get is basically a class that can be ultimately defined at runtime.

Commonly used for GUI style stuff.


I should point out that compositional structuring probably isn't the correct definition for this paragdim (I can't remember the actual name but it was something like that), but what you actually create is a composite in the conventional OO sense of the word.
int p; // A

Offline nyteschayde

  • VIP / Donor - Lifetime Member
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 636
  • Total likes: 0
    • http://www.nyteshade.com
Re: Native Objective-C compiler available
« Reply #21 on: November 12, 2013, 10:33:24 PM »
Quote from: falemagn;67265
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

I'd like to get ObjC working on my Amiga. This link is also no longer valid. Any ideas?
Senior MTS Software Engineer with PayPal
Amigas: A1200T 060/603e PPC • A1200T 060 • A4000D 040 • A3000 (x2) • A2000 Vamp/V2 • A1200 (x4) • A1000 (x3) • A600 Vamp/V1 • A500

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
  • Total likes: 0
    • http://www.troubled-mind.com
Re: Native Objective-C compiler available
« Reply #22 on: November 13, 2013, 08:31:36 AM »
Quote from: nyteschayde;752607
I'd like to get ObjC working on my Amiga. This link is also no longer valid. Any ideas?
AFAIK the latest gcc for 68k Amigas should support Obj-C, but you will need to install a runtime :)