Memory safe and coroutines are the focus of D.

IGotD- nise at nise.com
Wed Oct 19 22:45:05 UTC 2022


On Wednesday, 19 October 2022 at 18:50:37 UTC, jmh530 wrote:
>
> On 1, even if it is clear to the user what pointer type to use, 
> it's not always clear when to use which pointer type from the 
> perspective of the library writer. The library writer might 
> want the library to be indifferent to what memory management 
> scheme is used. They might be in the position of writing two 
> versions of the function (or a templated version of the 
> function) that supports each of the pointer types.

It usually very clear what pointer type to use and you can see it 
everywhere in other languages. It is that they use the native 
managed pointer for libraries intended to be used in the 
language. Like in C#, you never see raw pointers in libraries 
only the native reference and value types.

If you create FFI functions intended to be used by many 
languages, then you have no choice other than using raw pointers 
which is only common denominator there is.



More information about the Digitalmars-d mailing list