h a l f b a k e r yMake mine a double.
add, search, annotate, link, view, overview, recent, by name, random
news, help, about, links, report a problem
browse anonymously,
or get an account
and write.
register,
|
|
|
Please log in.
Before you can vote, you need to register.
Please log in or create an account.
|
Just like from french to chinese. (and the result will just as
unreadable, but useful)
[link]
|
|
Translating the language is probably fairly
straightforward (I assumeI'm not familiar with C#).
Translating the respective APIs (i.e., .NET to Cocoa)
would be nearly impossible. You'd need to write
some sort of abstraction layer for both APIs, and
even then you could only translate code that targets
that abstraction layer. And at that point, why bother
translating the language? You might as well just
write an ObjC .NET interface, or a C# Cocoa
interface. |
|
|
I guess if you dropped the "useful" requirement, it
might work. |
|
|
This is just a compiler, with a C# frontend, and an ObjC backend. Without knowing of any specific examples I won't go as far as to call it baked, but all the parts that make it up are well and truly baked, and plumbing them together wouldn't be a major challenge. |
|
|
As [ytk] points out, if you want to call the result "useful", all the pain will be in dealing with the APIs / standard libraries. |
|
|
(Another route you could take might be to translate .NET VM bytecode into ObjC - this lets you use the existing C# tools to do all the tricky parsing / validation etc of the C# source, and probably some optimisations too, leaving you with known-good input and a much easier task.) |
|
|
Doesn't C# compile to bytecode (.NET)? If so simply decompile the .Net to objective C. (Shouldn't be too difficult to write a ObjC from bytecode) |
|
|
Usually if its doable somebody already did it. |
|
|
[ [ NSForeignLanguageStatement
statementWithString: @"<STATEMENT>"
fromLanguage: [NSForeignLanguage
languageFromString: @"C#"] ]
evaluateAsLanguage:[ [NSObjectiveCLanguage
alloc] init] gently:YES]; |
|
|
There. All you need to do now is implement the
NSObjectiveCLanguage,
NSForeignLanguage, and
NSForeignLanguageStatement classes, and problem
solved. |
|
|
(For any innocent bystanders: Yes, Objective-C is
really that hideous in real life. That's one reason I
gave it up in favor of Ruby.) |
|
| |