January 05, 2016
On 1/5/2016 10:45 AM, Ola Fosheim Grøstad wrote:
> Calling the C function "void takesAnObject(void *theObject);" from Swift:

Interfacing with C doesn't mean jack when someone needs to interface with C++. D interfaced seamlessly with C from day 1.

January 05, 2016
On Tuesday, 5 January 2016 at 18:52:38 UTC, Walter Bright wrote:
> Interfacing with C doesn't mean jack when someone needs to interface with C++. D interfaced seamlessly with C from day 1.

Yes, but if you want ARC or high performance GC you have to pay a price when crossing boundaries.

Objective-C/C++ provides easy interfacing with C/C++... CoreFoundation provides easy bridging with Objective-C/Swift. Foundation provides seamless interfacing.

January 05, 2016
On Tuesday, 5 January 2016 at 15:40:40 UTC, Jacob Carlborg wrote:
> "Swift on Linux does not depend on the Objective-C runtime nor includes it"
>
> I'm guessing that Swift is compatible with Apple's Objective-C runtime, which is not the same as the GNUStep Objective-C runtime.

Thanks, that makes sense. I think ARC can be faster without the Objective-C dependency.

> On the other hand, I'm guessing it's possible to create a C bridge as well.
>
> [1] https://swift.org/blog/swift-linux-port/

Yep. Linux is dominated by C so it makes perfect sense to focus on Swift + C and make it perform well.

January 05, 2016
On 2016-01-05 17:24, Walter Bright wrote:

> Doing unwinding in D frames when foreign exceptions are in-flight is
> easy, because no knowledge of those FEs is required.
>
> Catching them, however, requires detailed knowledge of exactly how they
> work. This is not so easy. Catching C++ exceptions in D code will
> require some careful study and work, and that work will not be
> transferable to other FEs.
>
> But since there seems to be 0 demand for catching other FEs, or even
> interfacing D to other languages, this shouldn't be a problem.

Catching Objective-C exceptions might be interesting. If if catching C++ exceptions work, it should be trivial to add support for catching Objective-C exceptions as well.

-- 
/Jacob Carlborg
January 05, 2016
On 1/5/2016 10:57 AM, Ola Fosheim Grøstad wrote:
> CoreFoundation provides easy bridging with Objective-C/Swift.

CF is an interface to C, not C++, and it uses wrappers and such, not direct APIs. It also has COM-like support - D also supported COM since Day 1.

That isn't remotely good enough to be called an interface to C++.
January 05, 2016
On Tuesday, 5 January 2016 at 21:33:07 UTC, Walter Bright wrote:
> On 1/5/2016 10:57 AM, Ola Fosheim Grøstad wrote:
>> CoreFoundation provides easy bridging with Objective-C/Swift.
>
> CF is an interface to C, not C++, and it uses wrappers and such, not direct APIs. It also has COM-like support - D also supported COM since Day 1.
>
> That isn't remotely good enough to be called an interface to C++.

I think I wasn't clear in what I wrote. CoreFoundation is implemented in C, but CF objects aren't really an interface to C, but memory objects that (may) provide a toll free bridge to NSObject ARC protocols. Thus supports ARC by recasting a pointer rather than wrapping or conversion.

My point was more that in order to interface well with Swift I should generate objects that are toll free castable to ARC objects when I allocate. But I don't want that in my C++ code anyway, so therefore I might as well have a Objective-C++ layer between Swift and C++ on iOS.

I don't want lots of raw C malloc or C++ objects on the Swift side...

As Jacob pointed out, that does not work on Linux, but I am ok with C interfaces to C++ code on Linux.

iOS is different since so many OS calls _requires_ Objective-C function calls, so on iOS you often need to mix Objective-C and C++ (or whatever language you use).


January 05, 2016
On 1/5/2016 1:48 PM, Ola Fosheim Grøstad wrote:
> I think I wasn't clear in what I wrote.

At the moment I'm only interested in directly interfacing D to C++, not C (which D already does very well) or ARC (a totally different subject).

January 06, 2016
On Wednesday, 6 January 2016 at 00:08:35 UTC, Walter Bright wrote:
> On 1/5/2016 1:48 PM, Ola Fosheim Grøstad wrote:
>> I think I wasn't clear in what I wrote.
>
> At the moment I'm only interested in directly interfacing D to C++, not C (which D already does very well) or ARC (a totally different subject).

The topic someone in this subthread raised was whether other comparable languages have better C++ support than D or not. And my answer to that is that Objective-C++ and Swift over Objective-C++ has 100% support for C++. That's the discussion you entered.


1 2 3 4
Next ›   Last »