Would the ownership model make D lang as complicated as Rust?
timon.gehr at gmx.ch
Wed Nov 18 01:38:27 UTC 2020
On 18.11.20 02:19, Walter Bright wrote:
> On 11/15/2020 6:11 AM, donallen wrote:
>> 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.
> It's a similar approach to how D does functional programming. You can do
> FP in D on a totally incremental approach, function by function. And
> just like doing OOP in D, you can use it in parts of your program and
> not in other parts.
This works for `pure`, but not `@live`, because it is not an issue for
an impure function to call a `pure` one, but if a non-`@live` function
calls a `@live` one, the arguments may violate invariants that `@live`
users want to rely on.
In any case, `pure` is transitive. `@live` is not even transitive, so
you get the same problems the other way around.
More information about the Digitalmars-d