Forums
How is the objective-c backend supposed to work?
3 posts
• Page 1 of 1
How is the objective-c backend supposed to work?
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?
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
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?
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
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 61 guests