Thread overview
Objective-D released!
Nov 29
Luna
Jun 12
DanielG
Jun 12
Luna
Jun 12
DanielG
November 29

Objective-D is a new package, now available on dub which implements bindings to the Objective-C runtime as well as the Foundation core library. The goal is to provide a shared base that Objective-C bindings can utilize instead of packages repeatedly re-implementing NSObject, NSString, and the like. Additionally the clang block implementation by Jacob Carlborg, and my own implementation of auto release pools is provided. Which should allow for safer interop with Objective-C!

https://code.dlang.org/packages/objective-d

Additionally, I've been working on a pull-request to add Objective-C support to the LDC compiler, including support for binding Swift stub classes via a @swift UDA.

https://github.com/ldc-developers/ldc/pull/4777

This should over-all increase the usability of DLang on Apple-made systems.

November 29

On Friday, 29 November 2024 at 13:44:12 UTC, Luna wrote:

>

This should over-all increase the usability of DLang on Apple-made systems.

Thanks, this will be useful because to integrate Metal and do AUv3 (or even use anything iOS) there is lot of inheriting from Obj-C objects. Until that, it would requires gymnastics with the Obj-C runtime.

November 29

On Friday, 29 November 2024 at 13:44:12 UTC, Luna wrote:

>

Objective-D is a new package, now available on dub which implements bindings to the Objective-C runtime as well as the Foundation core library. The goal is to provide a shared base that Objective-C bindings can utilize instead of packages repeatedly re-implementing NSObject, NSString, and the like. Additionally the clang block implementation by Jacob Carlborg, and my own implementation of auto release pools is provided. Which should allow for safer interop with Objective-C!

[...]

this is great! Libraries like this are enablers for many people that would have most likely otherwise chosen another language or tool for the job.

November 29

On Friday, 29 November 2024 at 13:44:12 UTC, Luna wrote:

>

Objective-D is a new package, now available on dub which implements bindings to the Objective-C runtime as well as the Foundation core library. The goal is to provide a shared base that Objective-C bindings can utilize instead of packages repeatedly re-implementing NSObject, NSString, and the like. Additionally the clang block implementation by Jacob Carlborg, and my own implementation of auto release pools is provided. Which should allow for safer interop with Objective-C!

https://code.dlang.org/packages/objective-d

Additionally, I've been working on a pull-request to add Objective-C support to the LDC compiler, including support for binding Swift stub classes via a @swift UDA.

https://github.com/ldc-developers/ldc/pull/4777

This should over-all increase the usability of DLang on Apple-made systems.

As a Mac user, this is tremendous news! I must admit, I haven't looked at what this can do for my code, as I typically don't go to any of these libs, I generally stick with posix functions or phobos. But if nothing else, making ldc on par with dmd for Mac and iOS code will enable so much more for ARM Macs!

-Steve

June 12

Hijacking this thread a bit to ask a related question:

What's the overall feasibility of using pure D to rewrite a not-too-large amount of Cocoa/AppKit code?

Is it just a matter of translating the headers via 'dstep' or whatever? Does that work today, for something as complex as AppKit? (Also I'd need Quartz2D and CoreText, but I'm assuming those would be trivial since they have C APIs)

June 12

On Thursday, 12 June 2025 at 04:53:33 UTC, DanielG wrote:

>

Hijacking this thread a bit to ask a related question:

What's the overall feasibility of using pure D to rewrite a not-too-large amount of Cocoa/AppKit code?

Is it just a matter of translating the headers via 'dstep' or whatever? Does that work today, for something as complex as AppKit? (Also I'd need Quartz2D and CoreText, but I'm assuming those would be trivial since they have C APIs)

Should be decently feasible; though I am still working on translating Apple API headers to D. I don’t personally think that automatic translation is the way to go, as you miss out on good inline documentation and the like. So I prefer to hand-write my bindings. With the work I’m doing for Inochi2D I have started writing these bindings. So in due time I plan to have most if not all of the publicly documented Apple APIs available from D. Both ones based on Foundation and CoreFoundation.

Additionally I recently added toll free bridging support to objective-d as well; and plan to refine the helper system I wrote around it.

June 12

I see, thank you. (And thank you for your efforts in this area)