I've recently started a new employment, and with that new collegues and new language discussions/wars ;)

So there's this language Rust. And it provides some pretty amazing safety guarantees when it to memory management, algorithm correctness (preventing iterator invalidation) in both single threaded and multi-threaded contexts (task-based parallelism). One of its brightest shining showcases is Rayon:


and more specifically


After having given this a lot of thought I decided to think about if we can implement some of Rust's great ideas in D.

My conclusion so far is that we can convert some of Rust's great compile-time checks to corresponding run-time checks in D. And use these to provide safe scope-checked reference access to non-RC C++/Rust-style containers. With a one-word memory overhead alongside the container and range/slice.

Here's my proof of concept so far:


To understand it's usage start with looking at the unittests at


Note that it is used as a wrapper on top of a non-copyable array-container `Array` I've been developing the last months.


Reply via email to