objective c syntax

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

objective c syntax

Post by yacahuma »

Any objective c coders in the house??

I am trying to figure out what was the purpose of the objective c syntax. What are the advantages? why not use a more normal syntax(c,c++, java, php) and do something like frac->setNumerator(1)

Also there seems to be a lot of little additional characters to help the compiler(maybe)

Maybe someone with object-c experience can share some light. Thank you

// set the values
[frac setNumerator: 1];
[frac setDenominator: 3];

// combined set
[frac2 setNumerator: 1 andDenominator: 5];
User avatar
arjan.top
Forum Contributor
Posts: 305
Joined: Sun Oct 14, 2007 4:36 am
Location: Hoče, Slovenia

Re: objective c syntax

Post by arjan.top »

it is inspired by smalltalk, I would say
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: objective c syntax

Post by Weirdan »

yacahuma wrote: I am trying to figure out what was the purpose of the objective c syntax. What are the advantages? why not use a more normal syntax(c,c++, java, php) and do something like frac->setNumerator(1)
You have to know a bit of history to understand that. Objective C started its evolution as a superset of C (unlike C++ which started as a preprocessor to C) pretty much at the same time as C++ did. Both languages were not in common use and thus were not influencing each other. Besides, different level on which they were integrated into C made sharing the syntax harder, if not impossible (later C++ compilers appeared, but those were different times already). Other languages you mentioned appeared much later, in mid-90, thus obviosly ObjC could not borrow from them.

Objective C doesn't have to be 'better' than C++, as it's just another implementation of same ideas, on the same common base (C).

And yes, as arjan.top noted, Objective C is heavily influenced by Smalltalk.
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

Re: objective c syntax

Post by yacahuma »

thank you.
Post Reply