4 ms·
Rust achieves memory safety without a tracing GC. D has traditionally relied on the GC for that, but now there's [DIP1000](https://github.com/dlang/DIPs/blob/ma
by atilaneves 8y ago
Rust achieves memory safety without a tracing GC. D has traditionally relied on the GC for that, but now there's [DIP1000](https://github.com/dlang/DIPs/blob/master/DIPs/DIP1000.md https://github.com/dlang/DIPs/blob/master/DIPs/DIP1000.md). D can however be used without a GC if needed.
Rust has macros, which D doesn't, but D's metaprogramming is superior.
They're both fine choices.
- jetzzz 8y ago> Rust achieves memory safety without a tracing GC. D has traditionally relied on the GC for that Isn't D memory unsafe by default?
- atilaneves 8y ago> Isn't D memory unsafe by default? Yes, but it only takes this to guarantee it: void main() @safe { // ... }
- earenndil 8y agoNot quite, that doesn't guard for safety in things like module constructors.
- Hasknewbie 8y ago> D can however be used without a GC if needed Honest question: is it the case in practice though? Last time I checked D, you could disable the GC in theory, but in practice many things would fail to work, most importantly their standard library. As this been fixed since then?
- atilaneves 8y agoYes, it's the case in practice: I've written a lot of @nogc code. Some parts of the standard library require the GC, but not all of it, and the parts that I usually use are fine (std.algorithm, std.range, ...). Since allocators landed, it's been a lot easier, and I've written a library that does C++-style smart pointers for D: https://github.com/atilaneves/automem https://github.com/atilaneves/automem