On 09/25/2019 12:06 PM, WhatMeWorry wrote:
> I was
> assuming that [] meant "the entirety" of the array.
Assuming we're talking about D slices, Yes. (It could be a user-defined
type with surprisingly different semantics.)
> In short, is there anytime that one would want to use "slice[] =
> something" syntax?I
That changes element values.
> //waste[] = waste[0..$-1]; // object.Error@(0): Array lengths don't
> match for copy: 0 != 1
>
> waste = waste[0..$-1]; // works
That makes slice refer to a different set of elements. In that example,
the slice does not include the last element anymore.
Ali