News for hackers. Stuff that matters.
Re:Crafting Self-Evident Code with D by RcouF1uZ4gsC on Tuesday October 03, 2023 @10:48AM (#37752690)
D is a beautiful language.

However, its embrace in the 1990's of garbage collection has proved its Achilles heel. Before anyone says you can write D without the garbage collection, yes you can but then you lose access to most of the standard library, and likely most third party libraries. Rust and C++ allow you not to have to use garbage collection but still use the standard library and 3rd party libraries.

With garbage collection, D is not directly competing not with C++ but with Java, Swift, Go, C# which have far more support across the industry.

Re:Crafting Self-Evident Code with D by Alifatisk on Tuesday October 03, 2023 @12:23PM (#37754009)
It is indeed a beautiful language, what makes the GC such a no-no? Hard to work with in embedded systems?
Re:Crafting Self-Evident Code with D by mhh__ on Tuesday October 03, 2023 @02:28PM (#37755706)
Opposition to GC is mostly people being fooled by GC-ed languages tending to be higher level and thus generating more garbage.

> Embedded systems

In the embedded work I've done I barely allocate at all, so it matters not GC or otherwise.

Re:Crafting Self-Evident Code with D by daaaaaaan on Tuesday October 03, 2023 @01:00PM (#37754560)
Swift doesn't have garbage collection.
Re:Crafting Self-Evident Code with D by RcouF1uZ4gsC on Tuesday October 03, 2023 @02:07PM (#37755463)
Refcounting is a form of garbage collection. While C++ and Rust also have refcounting, it is the default memory management mode in Swift in a way that it is not in C++ and Rust (where the defaults are more using stack based or unique_ptr/Box before reaching for refcounting).
Re:Crafting Self-Evident Code with D by daaaaaaan on Tuesday October 03, 2023 @02:09PM (#37755492)
No, it's not. Refcounting CAN be a garbage collection algorithm, but in Swift it's deterministic and done at compile time. Not to mention recently added support for non-copyable types that enforces unique ownership: https://github.com/apple/swift-evolution/blob/main/proposals...
Re:Crafting Self-Evident Code with D by WalterBright on Tuesday October 03, 2023 @02:40PM (#37755856)
> you lose access to most of the standard library

That's simply not true. Only one of the algorithms in std.algorithm, for example, uses the GC.

The GC also enables much better compile time function execution.

Re:Crafting Self-Evident Code with D by MikeShah on Tuesday October 03, 2023 @03:04PM (#37756100)
It's worth noting many (A majority as I understand) AAA game studios end up writing their own STL. I'm willing to bet many industries where performance is the primary concern also write much of their core libraries from scratch.

D lets user opt-out of collector as needed which is quite nice. D has been used in AAA game development for what it's worth as well.

Re:Crafting Self-Evident Code with D by mhh__ on Tuesday October 03, 2023 @05:17PM (#37757701)
A lot of games have GCs...
Re:Crafting Self-Evident Code with D by MikeShah on Wednesday October 04, 2023 @01:54AM (#37761312)
Absolutely! Any game in C#, Java, or even C++ Unreal Engine games.

https://unrealcommunity.wiki/garbage-collection-36d1da