views:

547

answers:

1

I'd like to start developing applications for iPhone, but I'd really like to use OCaml rather than Objective-C. After some googling, it seems like this is definitely possible, but I haven't found any code snippets which actually compile.

Is it possible to write iPhone apps using OCaml? If so, could you provide a snippet demonstrating how to make calls into the Cocoa API from OCaml?

+3  A: 

Out of the box, OCaml cannot be used to build IPhone apps. You would have to have OCaml output ARM code rather than x86 code. You would also have to build wrappers for all the IPhone API calls.

Still, these guys are going through the pain to try this.

http://web.yl.is.s.u-tokyo.ac.jp/~tosh/ocaml-on-iphone/

My humble recomendation is that you focus on using Obj-C for everything. If you really want an ML, use it only for the kernel or the interesting portion. I would find an *ML that code gens to something like C, and then use that result as a library to the app.

Good luck.

drudru
+1: I was afraid it would be harder than it sounds, but think I can live with objective C... as long as I can figure out a clever macro which solves the upward and downwards funargs problem ;)
Juliet
You might check this out:http://www.plausiblelabs.com/blog/?p=8
drudru