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

IGotD- nise at nise.com
Tue Nov 17 10:54:20 UTC 2020

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.

More information about the Digitalmars-d mailing list