Would the ownership model make D lang as complicated as Rust?
donaldcallen at gmail.com
Sun Nov 15 14:11:51 UTC 2020
On Saturday, 14 November 2020 at 05:33:24 UTC, joe wrote:
> In regards to this article
> I have a couple of questions,
> 1. I was wondering if this is going to make D lang just as
> complicated as Rust?
> 2. Would there be GC still if we use the ownership model?
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).
I am retired from a long career in software development and
project management. I wrote my first line of code 60 years ago. I
have learned a lot of programming languages during all those
years and I have never encountered anything as difficult to learn
and use as Rust. Haskell is a walk in the park compared to Rust.
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.
Consideration of Rust require careful cost-benefit analysis. 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'm
ignoring the issue of deadlines and whether you already know the
language). They have done an excellent job, given the design
constraints they have chosen.
But if you are writing an ordinary application, such as my
financial application, Rust is not appropriate, in my view (I
suspected that going in, but I'm retired and also a bit of a
programming language enthusiast, so I went ahead despite my
doubts; had I been doing this in the real world of business, I
like to think that the project manager part of me would have done
something more sensible).
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.
More information about the Digitalmars-d