Re: assumeSafeAppend inconsistent when multiple slices in use

2011-04-07 Thread Steven Schveighoffer
On Thu, 07 Apr 2011 15:22:10 -0400, simendsjo wrote: I'm having some problems explaining it as I'm not sure about the correct terminology (I should have drawn some pictures..), but I'll try. The runtime doesn't track the "original" array and the slices (for this example at least - it obv

Re: assumeSafeAppend inconsistent when multiple slices in use

2011-04-07 Thread Steven Schveighoffer
On Thu, 07 Apr 2011 15:22:10 -0400, simendsjo wrote: On 05.04.2011 22:04, Steven Schveighoffer wrote: > However, a does not end on the master slice, so its capacity is 0. Note > that technically using a[1..$] is undefined at this point since the > runtime considers those elements 'unuse

Re: assumeSafeAppend inconsistent when multiple slices in use

2011-04-07 Thread simendsjo
On 05.04.2011 22:04, Steven Schveighoffer wrote: On Tue, 05 Apr 2011 15:24:46 -0400, simendsjo wrote: I don't know if this is an actual problem, but I don't understand the behavior. When one slice calls assumeSafeAppend, both slices is "given control", that is, gets the parents capacity. You

Re: assumeSafeAppend inconsistent when multiple slices in use

2011-04-05 Thread Steven Schveighoffer
On Tue, 05 Apr 2011 15:24:46 -0400, simendsjo wrote: I don't know if this is an actual problem, but I don't understand the behavior. When one slice calls assumeSafeAppend, both slices is "given control", that is, gets the parents capacity. You have to stop thinking of array slices as unique :

assumeSafeAppend inconsistent when multiple slices in use

2011-04-05 Thread simendsjo
I don't know if this is an actual problem, but I don't understand the behavior. When one slice calls assumeSafeAppend, both slices is "given control", that is, gets the parents capacity. It's best explained with an example: int[] a; a.length = 4; int[] b = a[0..1];