Would the ownership model make D lang as complicated as Rust?
nonexisting at nonexisting-host.net
Mon Nov 16 22:39:14 UTC 2020
On Sunday, 15 November 2020 at 14:11:51 UTC, donallen wrote:
> I can't answer your questions, but I can offer some
> observations based on my experience porting a personal finance
> application, originally written in C, to Rust (about 10,000
> lines of code).
Thank you for sharing your experience.
> Rust does what they say it will do -- deliver memory-safety
> without a garbage collector. But the incremental price you, the
> programmer, must pay for the absence of a GC is significant.
A really critical point which is often omitted describing Rust's
"memory-safety without a garbage collector" is that you can't
use reference cycles in your data.
And according to my (limited) academic knowledge, complete
compile time automatic memory management isn't simply possible.
(You have to use hacks like weak refs and other not fancy staff).
> If you are about to write something that requires absolutely
> predictable latency, where you would normally reach for
> something like C or C++, then Rust is probably a better choice
I haven't actually used (and seen) the Rust lang in embedded
but I read a comment from a guy whose complains I think may be
The Rust O/B system results in more usage of heap allocations.
(or even requires it due to borrow checker's limitations).
And in general, heap allocations can cause too high unpredictable
(this is also very often ignored).
> I don't know exactly how Walter intends to proceed with adding
> Rust-like move semantics to D, but the little I know suggests
> that it will be optional. If I'm right, that's very wise. Move
> semantics and no GC for those who really need it (justifying
> its cost) and the luxury of the GC for those who don't.
I hope D will be still getting simpler (not less complex - meaning
Making good API (which boosts developers productivity) is so
difficult that I appreciate more and more D developers'
to those all great libraries.
More information about the Digitalmars-d