Would the ownership model make D lang as complicated as Rust?

Max Haughton maxhaton at gmail.com
Tue Nov 17 18:02:00 UTC 2020


On Tuesday, 17 November 2020 at 11:34:01 UTC, Ola Fosheim Grøstad 
wrote:
> On Tuesday, 17 November 2020 at 10:54:20 UTC, IGotD- wrote:
>> On Monday, 16 November 2020 at 22:39:14 UTC, Piotrek wrote:
>>>
>>> And according to my (limited) academic knowledge, complete
>>> compile time automatic memory management isn't simply 
>>> possible.
>>> (You have to use hacks like weak refs and other not fancy 
>>> staff).
>>
>> Correct and Rust itself is a proof of that.
>
> Rust is not proof of that. However, it is often difficult to 
> prove properties of a graph that is transformed.

Rice's theorem means you can't just let the compiler do it for 
you, however rust doesn't do that. What Rust shows us that a 
conservative approach (i.e. annotations from the programmer and 
the exact rules the borrow checker allows) is more than enough to 
guarantee safety and manage memory productively.

D is already going in the right direction, the only issue really 
is that (as they are now) pointers are insufficiently expressive 
to be both safe and (say) act like C++ smart pointers and work 
with their de/allocators automatically. Ideally we would use 
structs but Rusts move by default semantics are an advantage we 
don't have.


More information about the Digitalmars-d mailing list