- DMD/Objective-C Alpha 1 (3.26 Mb)
- D/Objective-C compiler, June 1, 2011. Based on DMD 2.053.
- Chocolate Alpha 1 (52 Kb)
- Sample Cocoa project written in D/Objective-C, June 1, 2011. Requires D for Xcode.
You can track the development of this project from the Git repository at Github.
This project is an extension of the D programming language adding support for Objective-C objects. DMD/Objective-C is a modified version of DMD, the reference compiler for D, which implements those additions. The ultimate goal is to merge the capabilities back into mainline DMD, which should be doable once it is proven solid and usable enough.
With D/Objective-C, D can interact directly with Objective-C objects almost exactly as if they were regular D objects. All we have to do is provide a declaration for the classes we want to use.
When interacting with Objective-C objects or creating new derived classes, the D compiler emits compiled code similar to what an Objective-C compiler would emit. There is generally no performance penalty when calling Objective-C code from D or when implementing Objective-C classes in D.
D/Objective-C is targeted solely at Apple’s Mac OS X Objective-C runtime at this time.
How to Use
The download above contains a folder with the same layout as the official DMD distribution, so you should be able to simply replace any installation of DMD with this one and keep things working. It lacks support for platforms other than Mac OS X as well as some of Digital Mars’s proprietary tools; if you need any of the later you can find them in the official DMD distribution.
If you have installed D for Xcode, you can simply replace the “dmd2” folder it installed at “/Library/Compilers” with the download above (rename it to “dmd2”) to use it from Xcode.
Still to do
Code generation, especially putting symbols in the right segments of object files, still need some work. Linker issues can occur sometime due to this. In the Chocolate sample project, a C source file was added as the last file to be compiled an linked to work around that problem.
No declaration for Cocoa classes are provided at this time, you’ll have to write your own. Chocolate however contains some incomplete declaration for a couple of Cocoa classes.
There is no garbage collector support. This is planned for the future, but meanwhile you’ll have to use manual memory management (
autorelease) for Objective-C objects.
Some other things. Search for “unimplemented” in the syntax section for details.
There is a mailing list to discuss D/Objective-C. Any topic having something to do with the D and Objective-C may be posted there.
DMD/Objective-C Alpha 1 (2011-06-01)
- Initial release
DMD/Objective-C remains under the same license as DMD. The front end’s license is GPL/Artistic while the backend is under a proprietary license. Most of the runtime library and Phobos are under the Boost license. See the license file included with the distribution for details.
DMD/Objective-C is derived from DMD Copyright © 1999-2011 by Digital Mars written by Walter Bright. Distributed with permission.