Span currently has these ctors with two parameters:
public Span(T[], int)
public Span(void*, int)
internal Span(ref T, int) (currently internal, but potentially public in the future)
The usability issue is that the int parameter doesn't always mean the same thing: for the void* and ref ctors, it means length, but for the T[] ctor, it means offset. This leads to subtle bugs when switching back and forth between inputs, as a length can accidentally become an offset, or vice versa.
We should remove the public Span(T[], int) ctor to avoid the confusion. We will still have the public Span(T[]) ctor for cases where you want a span over the whole array, and we will still have the public Span(T[], int, int) ctor for cases where you want to specify the array, an offset, and a length, and for cases where you only want to specify the array and an offset, you can use new Span<T>(arr).Slice(offset) without ambiguity.
Span currently has these ctors with two parameters:
public Span(T[], int)public Span(void*, int)internal Span(ref T, int)(currently internal, but potentially public in the future)The usability issue is that the int parameter doesn't always mean the same thing: for the
void*andrefctors, it means length, but for theT[]ctor, it means offset. This leads to subtle bugs when switching back and forth between inputs, as a length can accidentally become an offset, or vice versa.We should remove the
public Span(T[], int)ctor to avoid the confusion. We will still have thepublic Span(T[])ctor for cases where you want a span over the whole array, and we will still have thepublic Span(T[], int, int)ctor for cases where you want to specify the array, an offset, and a length, and for cases where you only want to specify the array and an offset, you can usenew Span<T>(arr).Slice(offset)without ambiguity.