Is borrow checker the right thing for D?

Atila Neves atila.neves at gmail.com
Fri Aug 16 09:34:22 UTC 2019


On Thursday, 15 August 2019 at 19:53:59 UTC, IGotD- wrote:
> This is regarding the blog post
>
> https://dlang.org/blog/2019/07/15/ownership-and-borrowing-in-d/
>
> and the associated DIPs.
>
> What I'm worried about here is how this change would change the 
> aesthetics and usability of D. Right now it is Java like, the 
> garbage collector takes care of the memory and you can focus on 
> being productive.

Yes. And no.

Java only has primitives as value types, and you can't take their 
address. Everything else is on the heap (not necessarily in 
practice, but conceptually, yes), so the GC is enough for safety. 
D has structs, pointers, global variables: lots of ways to screw 
up that the GC can't help with. That's where DIP1000 et al come 
in.

I agree that D should be easier to use than Rust (it already is), 
and that the GC should be the default way of handling memory. We 
don't have any plans to change that. But, right now, it's 
possible to corrupt memory in D without the compiler telling you, 
and that's not a thing we want.


More information about the Digitalmars-d mailing list