On 2010-06-24 07:36:28 -0400, Trass3r <[email protected]> said:

How does it work?

http://michelf.com/weblog/2007/d-objc-bridge/

Could something similar be created for C++ (automatically creating wrappers around C++ classes or whatever)?

Hardly. You could probably manage it somewhat with a custom C++ preprocessor and imposing a common base class, sort of how Qt is build and probably more complex, but it wouldn't fit as well as it does with D. That all D classes derives from Object is quite handy for the bridge as it allows automatic mapping the Objective-C isEqual: method to opEquals, hash to hash, and compare: to opCmp. This automatically makes all D objects good citizens in Objective-C land, and vice-versa, even though you have to manually write mappings for method names if you have additional methods. D classes being always on the heap makes things much smoother too.


--
Michel Fortin
[email protected]
http://michelf.com/

Reply via email to