D not considered memory safe

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Mon Jul 1 14:05:07 UTC 2024


On 02/07/2024 1:40 AM, Brian Callahan wrote:
> ...at least according to Bleeping Computer: 
> https://www.google.com/amp/s/www.bleepingcomputer.com/news/security/cisa-most-critical-open-source-projects-not-using-memory-safe-code/amp/
> 
> "Memory-unsafe languages are those that do not provide built-in memory 
> management mechanisms, burdening the developer with this responsibility 
> and increasing the likelihood of errors. Examples of such cases are C, 
> C++, Objective-C, Assembly, Cython, and D."

They are indeed correct that D isn't memory safe however they are 
conflating multiple things here.

D has no solution to temporal safety which is what Rust has via its 
borrow checker.

For D the first step to temporal safety would be owner escape analysis 
which I am currently working on. However it is expensive as to do it 
properly means you need a DFA.

We do have a GC which does means we have memory safety in terms of 
lifetimes or non-owning data structures. Nor does this help with the stack.

Data races on the other hand is temporal safety + atomics + locks + 
immutable. We're missing what is needed to pull all that together right 
now as one feature.


More information about the Digitalmars-d mailing list