Challenge: write a reference counted slice that works as much as possible like a built-in slice
Stanislav Blinov
stanislav.blinov at gmail.com
Tue Nov 9 17:26:32 UTC 2021
On Tuesday, 9 November 2021 at 17:15:59 UTC, Atila Neves wrote:
> This is already something we're looking into it as part of the
> vision for D. I personally will not rest until such a library
> type can be written and used in @safe code. Nobody* should be
> calling malloc/free, just like nobody should be writing
> new/delete in C++14 and newer.
>
>
> * Obviously for values of "nobody" that are tiny but not
> exactly equal to 0.
Au contraire. EVERYBODY should be calling malloc/free or any
other allocators, including the GC. No matter how hard you try,
you CANNOT abstract the machine and remain a systems language at
the same time. If you don't want to be worrying about such
things, there are other, higher level, languages.
It's the calling of such APIs that must be made @safe. Walter is
attempting just that with @live. Incidentally, if THAT is made
possible, you will be able to have the cake and eat it too.
BTW, at the moment, "safety" of GC is a lie. Because it can run
arbitrary unsafe code within a @safe function.
More information about the Digitalmars-d
mailing list