Forums

How is the objective-c backend supposed to work?

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

How is the objective-c backend supposed to work?

Postby gradha » Wed Feb 09, 2011 2:00 pm

All this time I've thought that Cobra was running on .Net/Mono because it would compile bytecode for these platforms. But there's no similar bytecode for the Objective-C, yet there are traces of it in the repository. How is this going to work? I mean, translation from one language to another is nothing new, but how are going to be implemented Cobra features not available on the Objectve-c side?
gradha
 
Posts: 23

Re: How is the objective-c backend supposed to work?

Postby Charles » Wed Feb 09, 2011 8:08 pm

Any feature not directly available in Obj-C will have to be implemented with additional code generation that captures the semantics of that feature. Really this is no different than what a translator that generates assembly or machine code has to do.

Interestingly, there are already a lot of features in Obj-C that map to Cobra quite nicely such as garbage collection, classes, inheritance, protocols/interfaces, etc.

For each feature that does not map, you have to ask the question "What specific code generation is required to implement this?". So for example, Cobra on .NET/Mono supports first class contracts including semantics around inheritance. Additional code is generated to make that happen.

With Obj-C being a proper superset of C, we can also fall back to any C-level tricks that help us out (unions, pointers, etc.).

Was there a particular feature you were thinking of?

Btw Cobra generates C# rather than bytecode for various benefits, such as ensuring that Cobra programs have maximum compatibility in the .NET world.

HTH
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: How is the objective-c backend supposed to work?

Postby gradha » Thu Feb 10, 2011 1:01 am

Didn't know Cobra produced C# source code. That may come in handy if I find somebody opposed to the language itself. Thanks for your answer.
gradha
 
Posts: 23


Return to Discussion

Who is online

Users browsing this forum: No registered users and 8 guests

cron