Eight functions that the file used to refuse by name, and the refusal was always one sentence -- there is no allocator -- which stopped being true when Vec landed. Three rules hold across all of them and are written at the head of the section: the result is owned and the caller frees it, the allocator is the context's, and no signature carries a Result because no allocating operation returns an error. The builder is not a type. Odin's strings.Builder wraps a [dynamic]u8; here the (Vec u8) already is that and already has push, so a wrapper would be a move-only struct whose only method is the one it wraps. What was missing is appending a run of bytes, and append! is that -- taking a (Ptr (Vec u8)), because a Vec parameter moves and a by-value builder would be consumed by its first append. append-i64! and append-f64! are the argument for the whole shape. The runtime renders numbers into one shared static buffer, so two of its results cannot be held at once; these copy out before returning, so a builder holds as many numbers as it likes. strings.flan puts two integers and a float on one line to show it. split returns a (Vec [u8]) and not a (Vec (Vec u8)): the fields borrow the input, and the owning shape is refused outright because a Vec copies and releases its elements bytewise. Constructing it needed a one-line slices-new, because (vec-new) takes its element type as a bare symbol and [u8] is not one -- a compiler gap, noted rather than worked around in silence. replace-bytes guards its empty needle with an if and not an early return: a returned Vec is a move, the dead set spans the function, and a return on one branch would kill the binding on the other.
Description
Languages
OCaml
67.2%
Emacs Lisp
15.2%
C
10.4%
HTML
2.9%
Standard ML
2.8%
Other
1.5%