www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Objective-D released!

reply Luna <luna foxgirls.gay> writes:
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.
Nov 29 2024
next sibling parent Guillaume Piolat <firstname.name spam.com> writes:
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.
Nov 29 2024
prev sibling next sibling parent WebFreak001 <d.forum webfreak.org> writes:
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.
Nov 29 2024
prev sibling next sibling parent Steven Schveighoffer <schveiguy gmail.com> writes:
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
Nov 29 2024
prev sibling parent reply DanielG <simpletangent gmail.com> writes:
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)
Jun 11
parent reply Luna <luna foxgirls.gay> writes:
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.
Jun 11
parent DanielG <simpletangent gmail.com> writes:
I see, thank you. (And thank you for your efforts in this area)
Jun 12