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

Paulo Pinto pjmlp at progtools.org
Tue Nov 17 12:26:24 UTC 2020


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 has to often 
> rely on reference counting where the compiler cannot determine 
> the lifetime, typically when multiple ownership is required. 
> Furthermore, the compiler cannot even always determine the 
> borrow checker at compile time and programmer must use RefCell. 
> RefCell basically inserts runtime checks that the compiler 
> would otherwise be capable to infer at compile time. Rust try 
> to market itself as a silver bullet for lifetimes and how safe 
> it is but the reality is different.
>
> Rust started something interesting but I think that the Rust 
> object lifetime model will be unique for Rust only. Pieces of 
> the knowledge will be used in future compilers.

Rust got the ball rolling for the ideas prototyped in Cyclone and 
Linear Lisp.

Even if the language dies tomorrow, it has already made a mark on 
Swift, D, Chapel, ParaSail, C++, Haskell, Idris(2), F*, Dafny and 
probably others.

This is where I see the evolution of systems languages, some form 
of GC (yes it includes RC as algorithm) alongside some kind of 
support for linear/affine types for those critical code sections.

It doesn't need to be perfect, just good enough.


More information about the Digitalmars-d mailing list