Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> One possible difference is that Apple has signaled that Swift will be the language at some point

Have they? Then I really hope they add some easy form of C++ interop to swift in a future release.

There's so much C++ code out there in the Mac/iOS world that rewriting it to swift (or even just wrapping it in C) would make no economic sense.



Since you can use Objective-C (and therefore also Objective-C++) libraries directly in Swift, it actually has quite a nice integration. Objective-C++ is a far better interface layer than something like FFI or having to write C wrappers for everything (as you see in most other languages).


Nitpick: Objective-C and C are terrific for interoperation. FFI works pretty well with Obj-C and C too because it is all based on C binary compatibility and predictable symbol mangling. This is how previous Apple language bridges like PyObjC and RubyCocoa worked.

C++ and thus Objective-C++ has always been a disaster for FFI or anything that depends on binary compatibility or predictable symbol name mangling. Obj-C++ has a lot of ugly areas partly because of this. Kudos to Apple to making it work as well as it does.

Swift is terrific that it also seems to interoperate with C/Obj-C nearly seamlessly (bridging headers), but it is no surprise that the Swift documentation immediately says it doesn't support C++ and you must build C interface wrappers.

* Edit: reclarified comment


> Have they?

Pretty much; Apple doesn't tend to release big things like this on a whim. At minimum they've certainly signaled that Swift will be treated as a first-class language on par with Objective C, and has every likelihood to replace ObjC for most use cases.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: