Challenge: write a reference counted slice that works as much as possible like a built-in slice

Atila Neves atila.neves at gmail.com
Tue Nov 9 17:15:59 UTC 2021


On Tuesday, 9 November 2021 at 15:54:01 UTC, jmh530 wrote:
> On Tuesday, 9 November 2021 at 15:37:13 UTC, Atila Neves wrote:
>> [snip]
>>
>> The main point of vector is that one can append to it without 
>> using the GC. I guess that "this thing has a length only known 
>> at runtime that won't change and doesn't use the GC" is useful 
>> too, but not nearly as much as being able to append.
>
> Regardless, the limitations of the language and the solutions 
> brought up have been discussed on the forums for years. Getting 
> some kind of pathway forward is really what is needed. Breaking 
> the problem that Andrei brings up into a smaller one, i.e. 
> writing a @safe appendable vector that works as much like a 
> built-in one, is a useful start.

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.


More information about the Digitalmars-d mailing list