ArrayMatchable
public protocol ArrayMatchableProtocol enabling array patterns ([a, b], [a, ..rest],
[a, .., z], [a, ..rest, z]).
The compiler routes match-arm element access through matchGet and
rest-binding through matchSlice — they take Int64 bounds the
compiler has already verified. A conformer may assume 0 <= index < matchLength() and 0 <= from <= to <= matchLength() and skip its
own bounds checks; the conformance is unsafe to satisfy if those
invariants don't hold. Array[T] and ArraySlice[T] are the canonical
conformers.
Associated Types
type Element
type ElementMethods
func matchGet(Int64) -> Element
func matchGet(Int64) -> ElementReturns the element at index. Caller (the compiler) guarantees
0 <= index < matchLength() — implementations may skip bounds checks.
func matchLength() -> Int64
func matchLength() -> Int64Total number of elements available to match.
func matchSlice(Int64, Int64) -> ArraySlice[Element]
func matchSlice(Int64, Int64) -> ArraySlice[Element]Returns the slice [from, to). Caller guarantees
0 <= from <= to <= matchLength().
Defined in lang/std/core/protocols.ks