Safe and C++

Ola Fosheim Grøstad ola.fosheim.grostad at
Wed Nov 27 09:20:14 UTC 2019

My understanding is that the current two big goals for D is:

1. To have 100% memory safe code as the default.

2. Being able to use large C++ frameworks.

So, these would be two major features, but how are they going to 

Right now ownership/borrowing seems to be discussed entirely in a 
pure D context, but that isn't very helpful if you want to use a 
C++ framework to build an application in D.

So, basically what D needs is a way to annotate C++ interfaces 
with ownership-information so that you can do static analysis on 
safe D code that calls into C++ frameworks and objects.

Static analysis requires knowledge of whether a C++ object is 
reference counted, owning, borrowing and what lifetime guarantees 
the safe D code has to obey by.

Seems to me that working on ownership for D won't help much. You 
need something more abstract that also works for existing C++ 

If not, you end up with 2 languages:

1. An unsafe one for building with C++ frameworks.
2. A safe one for primarily building with D frameworks.

Which seems a bit pointless, considering all the work involved.

More information about the Digitalmars-d mailing list