views:

835

answers:

7

I do not have a Mac, or an iPhone. However, the concept of taking C and making it more dynamic towards the idea of smalltalk, python or ruby is really attractive to me. I'd love to start on objective C.

Is objective C just a syntax superset of C or is it really like C. As in, can it be compiled with gcc etc..?

I do most of my programming in Ruby. Objective C seems so much more forgiving than C. You can write native extensions for Ruby in C. Can you write native extensions for Ruby in Objective C?

How can I get started with Objective C outside of owning an Mac/iPhone and having XCode?

+4  A: 

Wikipedia says

Today it is used primarily on Apple's Mac OS X and iPhone OS, two environments based on, although not compliant with, the OpenStep standard, and it is the primary language used for Apple's Cocoa API though it was originally used as the main language on NeXT's NeXTSTEP OS. Generic Objective-C programs which do not make use of these libraries can also be compiled for any system supported by gcc, which includes an Objective-C compiler.

Objective-C today is often used in tandem with a fixed library of standard objects (often known as a "kit" or "framework"), such as Cocoa or GNUstep.

Maybe you should get a Linux vm if you are mainly running Windows and get GNUStep running.

eed3si9n
+1  A: 

vixML released a iPhone SDK for Windows about a month ago.

tester
+2  A: 

Yes, you can write, compile and run objective c programs outside a MAC/IPhone

Please check the link below for details http://www.otierney.net/objective-c.html#settingup http://www.faqs.org/faqs/computer-lang/Objective-C/faq/

vprasanth
+1  A: 

There's a difference between Objective-C the language, and the frameworks that Apple has built on top of it. Those frameworks consist of a bunch of objects which you can use in your code and are especially helpful if you're targeting the Mac or the iPhone. There are some similar objects for parts of it in GNUStep, but it's not a complete replacement for the Cocoa/etc library and especially doesn't cover anything iPhone related.

GNUStep and the Objective-C language (via gcc) are available for many platforms, and you can write your own programs that use Objective-C objects and interact with any C api from Objective-C.

Objective-C is a superset of C and so is not really more forgiving than C, but it is arguably more forgiving than C++ (an almost-superset of C). You can also mix Objective-C and C++ with GCC but that gets a little complicated, especially regarding exception handling.

For getting started and playing around with the language though, GNUStep and GCC would be a good way to go.

Mike Kale
I'm pretty sure Objective-C is a strict superset of C, unlike C++ which has a few (but not many) clean breaks from C.
Chris Lutz
Objective-C is a complete superset of C, not an almost superset.
Jason Coco
Ok, sorry about that (I'm more familiar with C++ than Obj-C). I'll correct the text, in any case from a practical perspective both are a superset of C.
Mike Kale
+3  A: 

apple contributed the objective c changes back to gcc (not that they had much choice, being GPL). So wherever you can set up gcc, you can set up an objective-c compiler.

Beyond that, the Gnustep environment can give you a bit of the flavor of the original OpenStep/NextStep environment.

simon
A: 

I don't see any compelling reason why you cannot use Objective C for native ruby extensions, except that you won't benefit much. You will still have to use the lower level C Api calls, since as far as i know, there aren't any ruby to objective-c bindings. Additionally, Objective C comes with a fairly substantial library of utility classes that, while helpful, won't easily justify their size and weight in the context of a ruby extension.

TokenMacGuy
What substantial library of utility classes? Objective-C comes with practically nothing.
Chuck
A: 

You can you this page for simple experiments with ObjC: http://www.codesign.cz/LearnObjC/

Peter