DIP 1025--Dynamic Arrays Only Shrink, Never Grow--Community Review Round 1

Exil Exil at gmall.com
Mon Nov 11 22:12:44 UTC 2019

On Monday, 11 November 2019 at 21:41:14 UTC, Walter Bright wrote:
>> This is what the dead/alive example is supposed to express.
>> It is still true however that the rationale is not very 
>> convincing.
>> The first example indeed doesn't show any benefits of the DIP:
>> ```
>> int[] slice = cast(int*)malloc(10 * int.sizeof)[0 .. 10];
>> slice = slice ~ 1; // now guaranteed to make a copy
>> free(slice.ptr); // Still oops
>> ```
> Imagine these 3 lines are spread out over a large code base.

You realize he changed the code right? That is still valid code 
that exhibits the same problem even after this DIP gets 
integrated into DMD.

>> The following claim in the DIP is also unsubstantiated:
>>> This change is a necessary part of D evolving towards being 
>>> memory safe without using
>>> a GC.
> Memory safety cannot be achieved without control over who is 
> the owner of memory.

So is the GC being removed from D? Is this the ultimate goal? 
Cause the convenience of the language that is provided by using a 
GC is being removed along with these DIPs. At some point there's 
not going to be a reason to the GC because all of its' 
conveniences will have been removed at this rate.

More information about the Digitalmars-d mailing list