On Wednesday, 1 February 2017 at 09:50:42 UTC, osa1 wrote:
Thanks for the answer. Could you elaborate on the lacklustre part? It's fine if I have to do manual memory management, but I don't want any leaks. Ideally I'd have a precise GC + RAII style resource management when needed.

Rust, Go, Java, Swift etc have a single memory management scheme which is used by libraries and mostly enforced by the compiler.

In C++ you tend to go with unique ownership and occasional shared ownership with the ability to have weak pointers and swap out objects without updating pointer, and there is an easy transition form old ad-hoc ownership to shared (the reference counter is in a separate object). It is not enforced by the compiler, but C++ is moving towards having dedicated tools for checking correctness.

In D the goal is to have safety enforced by the compiler, but it isn't quite there yet and what is on the map for leak free resource management seems a simple reference counting mechanism (simpler than swift?) with refcount embedded in objects (like intrusive_ptr in Boost except the compiler is intended to be better at optimizing unnecessary updates of the reference count).

Reply via email to