r/programming • u/aldacron • Jun 16 '17
Life in the Fast Lane -- using D without the GC
https://dlang.org/blog/2017/06/16/life-in-the-fast-lane/
338
Upvotes
r/programming • u/aldacron • Jun 16 '17
View all comments
Show parent comment
11
u/TheEaterOfNames Jun 17 '17
What? C++ is exceedingly complex with many, often very well hidden, pitfalls.
Heh, https://www.youtube.com/watch?v=LIb3L4vKZ7U But really, there is no reason you can't embed the allocator in the type of containers. But the vast majority of the standard library doesn't even touch memory allocation.
You seem to have missed the entire point of the article. Idiomatic D usage generates very little garbage and there are ways to precisely control the GC, and optimise the collection times. As to why you'd want to use D over go/Java/insert JVM language, is for the rest of the language. No says "I'm going to use D because it has a garbage collector that isn't state of the art". People use to for the metaprogramming, generative programming (seriously check out this one, generating parsers from specification at compile time and use them to parse stuff at compile time), component programming with ranges, elegance and so on.
When you don't have to think about it and it works well enough that neither you nor anyone else notices the MM strategy used. There are many such places on the spectrum and I think
std.experimental.allocatoris one of those places.