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

IGotD- nise at nise.com
Mon Nov 11 14:48:54 UTC 2019


On Monday, 11 November 2019 at 10:27:26 UTC, Mike Parker wrote:
> This is the feedback thread for the first round of Community 
> Review for DIP 1025, "Dynamic Arrays Only Shrink, Never Grow":
>
> https://github.com/dlang/DIPs/blob/1b525ec4c914c06bc286c1a6dc93bf1533ee56e4/DIPs/DIP1025.md
>
> All review-related feedback on and discussion of the DIP should 
> occur in this thread. The review period will end at 11:59 PM ET 
> on November 25, or when I make a post declaring it complete.
>
> At the end of Round 1, if further review is deemed necessary, 
> the DIP will be scheduled for another round of Community 
> Review. Otherwise, it will be queued for the Final Review and 
> Formal Assessment.
>
> Anyone intending to post feedback in this thread is expected to 
> be familiar with the reviewer guidelines:
>
> https://github.com/dlang/DIPs/blob/master/docs/guidelines-reviewers.md
>
> *Please stay on topic!*
>
> Thanks in advance to all who participate.

"Enlarging a slice, using the append operator or by setting the 
.length property, makes use of the garbage collector. This 
fosters the incorrect notion that D slices require the GC."

The title mentions arrays but the rest of the text is about 
slices.

I need one clarification, this DIP regards slices not arrays? So 
an array is being able to be resized just as before. It's just 
that this will no longer apply for slices?

If this only regards slices, then I think this is a sound change, 
even if it is breaking. A slice should not really know the 
underlying algorithm how the data is stored. It could be an 
array, it could be part of a buffer or a view into any other 
structure. Limiting the slice so that it cannot grow beyond its 
original boundaries makes sense.

If this include arrays, that they aren't able to grow then I'm 
against this change but again it doesn't make any sense. Then it 
is not a dynamic array.



More information about the Digitalmars-d mailing list