Originally Posted By: drakino
But the OS would need APIs for all those languages right?

Okay, I'm not familiar with the iPhoneOS, so I could be making an inaccurate assumption, but that's not the case for any other OS I've dealt with.

Okay, to be fair, I'm conflating APIs and ABIs, but there's really not a lot of difference in this case. When you natively compile a program, it has to make calls to subroutines that the OS provides. The OS defines the method by which those subroutines are found by the program, how data is passed back and forth, etc. Once you compile something natively, there's no difference in those calls between programs written in different languages. Think about the machine code or assembly code that a compiler produces: there's no real concept of functions or variables, there's just memory (and registers) to be accessed and a pointer to the currently executing instruction.

That said, it's possible that the iPhoneOS itself is something of a compatibility layer between iPhone apps and the "real" operating system. I've never even looked at developing for the iPhone, so I can't say for sure. Even if it were, though, there still has to be some defined way to call OS subroutines.

Edit: Regardless, there are any number of ways that people automatically convert one language to another. (The example that comes to mind here is TeX. Knuth wrote it in a language he designed called "Web", for which I don't believe there exist any compilers or interpreters. His original implementation used Pascal as an intermediary step. So if you want a TeX implementation for your iPhone, you're now out of luck.) They've explicitly disallowed that, and if you were to use the A{P,B}I Apple provides for that language, there would be no incompatibility issue. What difference is there between XCode typing "#include <iphone.h>" for me and some other program doing the exact same thing?


Edited by wfaulk (08/04/2010 23:24)
_________________________
Bitt Faulk