On Sunday, 31 May 2015 at 09:24:29 UTC, Jacob Carlborg wrote:
I've been trying to write a plugin for TextMate in Swift. TextMate is written in C++ with the GUI code in Objective-C. It's quite difficult and currently it's probably 50% Objective-C++ code and 50% Swift. Not taking in to account the C++ declarations for the TextMate code I need to interface with.

I've read a little bit about FFI and Swift now. Since Swift can call C using the native Objective-C type aliases (Int32, Int64 etc) it seems that direction is not so problematic. The ideal would be for the D compiler to generate Swift stubs that wrap up D-calls as C-interfacing calls, with the necessary type conversions specified as UDAs?

Smaller functions could even be translated into pure Swift. You probably also could create some kind of standardized wrapper that catch exceptions and turn them into something that won't be too ugly on the Swift side.

Then you have the other direction, which probably is where your Objective-C work is most important. Where you kinda will need a Swift parser to generate D stubs, but in that direction you do at least not have to deal with exceptions.

Do the same for JNI et al, add ARM support and tune D for performant GC… then you have something that could become popular. But to get there takes a lot of focused effort…

Reply via email to