Memory safe and coroutines are the focus of D.

Araq rumpf_a at web.de
Mon Oct 17 17:50:29 UTC 2022


On Monday, 17 October 2022 at 14:51:09 UTC, jmh530 wrote:
>
> Walter's argument against this has been that it forces the user 
> to write multiple copies of the function to support both 
> pointer types. Even if you have a templated version to handle 
> it, you would still have two copies.
>
> You would need some kind of type erasure, similar to inout (not 
> that inout pulls its weight), and I'm sure there would be a lot 
> of complications associated with it.

The distinction between managed and unmanaged pointers can also 
be found in: C#, C++ (shared_ptr), Rust (Arc), Swift, Go (Go uses 
'uint' for untraced pointers IIRC)... In practice it doesn't lead 
to multiple copies of the same code for two reasons:
1. It's clear when to use which pointer type.
2. Unmanaged pointers are used much more rarely because automatic 
memory management simply works much better than manual MM; it's 
simply much more cost effective.



More information about the Digitalmars-d mailing list