Slices: spans you consume head-first

A slice is the ABC way to pass a span of memory: a pair of pointers [head, term), consumed by moving head toward term. It replaces the pointer-plus-length pair, so a function that reads or writes part of a span advances the head and the remaining work is simply the rest of the slice there is no separate count to keep in sync. Four const shades encode intent, typed helpers move the borders, and a_-macros carve slices over arrays, literals, and buffers without any pointer arithmetic.

The four shades

A slice's type says what you may do to it: change the bytes, or move the pointers. Picking the right shade documents whether a function consumes its input or only reads it.

Typed helpers

Prefer the typed function over the generic macro: the typed names move borders explicitly and read clearly. Reach for a generic only when no typed form exists.

Creation and iteration

Slices are carved over existing memory with a_-macros, never by computing pointers. Walk them with the $for family, which iterates without exposing raw pointer math.

Gauges

A gauge is two adjacent slices sharing a boundary a left part and a rest used to build a span up in place. Unlike a buffer it owns no memory.