csv_utils — Parsing Implementation Design #
Overview #
The parser is built as a strict layering on top of a single low-level
state machine, FieldIterator, which is the only component that reads
bytes from the underlying std.Io.Reader. Every other tier (row
iterator, header-aware row iterator, in-memory table, header-indexed
table) is a thin transformation of fields into a more convenient shape,
adding row grouping, header copies, or bulk materialisation as needed.
This single-source-of-truth design means every requirement on parsing
correctness, error reporting, and BOM handling is implemented exactly
once, in FieldIterator, and inherited by every higher tier.
The Zig 0.16 Io.Reader API (peekByte, peek(n), takeByte,
take(n), discardAll) gives us bounded lookahead "for free" through
the reader's own buffer, so the parser stores no per-byte buffering of
its own beyond the caller's field buffer.
Architecture #
┌────────────────────┐
Writer (out of scope) │ HeaderTable │ ← lookup by (row, name)
│ (allocates) │
└─────────┬──────────┘
│ builds on
┌─────────▼──────────┐
│ Table │ ← owned 2-D []const u8
│ (allocates) │
└─────────┬──────────┘
│ drives
┌─────────▼──────────┐
│ HeaderIterator │ ← lookup by name per row
│ (allocates) │
└─────────┬──────────┘
│ wraps
┌─────────▼──────────┐
RowIterator family │ RowIterator │ ← allocating, grows
(all wrap │ BoundedRowIterator(N) ← comptime cap, stack
FieldIterator) │ FixedBufferRowIterator ← caller buffer
└─────────┬──────────┘
│ wraps
┌─────────▼──────────┐
│ FieldIterator │ ← THE state machine
│ (no allocation) │
└─────────┬──────────┘
│ peek/take/discardAll
┌─────────▼──────────┐
│ std.Io.Reader │
└────────────────────┘
The original clean layering is restored: every higher tier wraps a
RowIterator (or, in the allocator-free case, one of its variants).
The three RowIterator variants differ only in how their row-slot
storage is sourced — allocating heap, comptime stack array, or
caller-provided buffer — mirroring the standard library's
ArrayList / BoundedArray / FixedBufferAllocator split.
Source layout (unchanged from current stubs):
| File | Role |
|---|---|
dialect.zig |
Dialect struct + validation |
error.zig |
Unified Error set |
field_iterator.zig |
The state machine — the only reader-touching code |
row_iterator.zig |
Field-grouping into Row values |
header_iterator.zig |
Header capture + per-row name lookup |
table.zig |
Owned 2-D in-memory parse |
header_table.zig |
Table + duplicate-header / width policies + index |
root.zig |
Public re-exports + convenience wrappers + doctests |
writer.zig |
Untouched in this feature |
Data model / interfaces #
Dialect #
pub const Dialect = struct {
delimiter: u8 = ',',
quote_char: u8 = '"',
/// Strip a leading UTF-8 BOM (EF BB BF) if present. Default: on
/// (matches Excel-exported files; correctness #19).
strip_bom: bool = true,
pub fn validate(self: Dialect) Error!void {
if (self.delimiter == self.quote_char) return error.InvalidDialect;
if (self.delimiter == '\n' or self.delimiter == '\r') return error.InvalidDialect;
if (self.quote_char == '\n' or self.quote_char == '\r') return error.InvalidDialect;
}
};
trim is intentionally removed (out of scope). validate is called by
every init that takes a Dialect, including downstream tiers; this
satisfies Story 6 acceptance #4.
Error (unified set) #
pub const Error = error{
// Parser-detected malformed input
UnterminatedQuotedField,
UnexpectedQuote,
UnexpectedByteAfterQuote,
// Caller-buffer exhaustion
FieldTooLong,
RowTooWide,
// Dialect / configuration
InvalidDialect,
// Header tier
UnknownHeader, // currently surfaced via optionals only;
// reserved for future strict-lookup variants
DuplicateHeader,
RowWidthMismatch,
// Propagated allocator errors
OutOfMemory,
} || std.Io.Reader.Error; // ReadFailed, EndOfStream where applicable
Per N-5, every public function's error set is a subset of Error.
FieldIterator #
State and interface:
pub const FieldIterator = struct {
reader: *std.Io.Reader,
field_buf: []u8,
dialect: Dialect,
// Internal state. Opaque to callers.
state: State,
last_was_row_end: bool, // disambiguates "trailing newline" from
// "row of one empty field" (correctness #8,#9)
pending_error: ?Error, // sticky after malformed input (correctness #14)
pub const Result = struct {
data: []const u8, // borrowed from field_buf; invalidated by next()
end_of_row: bool,
};
pub fn init(reader: *std.Io.Reader, field_buf: []u8, dialect: Dialect) Error!FieldIterator;
pub fn next(self: *FieldIterator) Error!?Result;
};
const State = enum {
start, // before any byte consumed; may need BOM strip
field_start, // at the beginning of a field
in_unquoted, // inside an unquoted field, accumulating
in_quoted, // inside a quoted field, accumulating
after_quote, // just saw a closing quote, deciding what's next
eof,
failed, // stuck on pending_error
};
init returns Error!FieldIterator (rather than the stub's bare
FieldIterator) so that Dialect.validate failures surface without a
panic. This is a deliberate API change from the stubs; all higher tiers
propagate it.
RowIterator and its variants #
The original stub asked the caller to pass a [][]const u8 row
buffer. Review feedback rejected this: a byte buffer ([]u8) is
unsurprising in Zig, but a buffer of slice headers exposes an
implementation detail and is awkward to size. We instead provide
three variants of the row iterator, named to mirror standard-library
precedent for the same storage trade-offs:
| Variant | Storage strategy | std analog |
|---|---|---|
RowIterator |
Allocating, grows on demand | ArrayList |
BoundedRowIterator(N) |
Comptime-fixed capacity, stored inline in the struct | BoundedArray(T, N) |
FixedBufferRowIterator |
Wraps a caller-provided [][]const u8 |
FixedBufferAllocator |
All three yield the same Row value. Pick the one whose storage
matches your situation:
- Have an allocator? Don't want to think about column limits?
Use
RowIterator. - No allocator; column count fits a known maximum? Use
BoundedRowIterator(N). - No allocator; column count is runtime-determined? Use
FixedBufferRowIterator(least common).
pub const Row = struct {
fields: []const []const u8, // borrowed; lifetime = until next call
pub fn count(self: Row) usize { return self.fields.len; }
pub fn at(self: Row, i: usize) ?[]const u8 {
return if (i < self.fields.len) self.fields[i] else null;
}
};
RowIterator (allocating, default) #
pub const RowIterator = struct {
field_iter: FieldIterator,
row_buf: std.ArrayListUnmanaged([]const u8),
allocator: Allocator,
pub fn init(
reader: *std.Io.Reader,
field_buf: []u8,
allocator: Allocator,
dialect: Dialect,
) Error!RowIterator;
pub fn deinit(self: *RowIterator) void;
pub fn next(self: *RowIterator) Error!?Row;
};
The row buffer grows on demand. There is no RowTooWide failure mode
for this variant — a row is bounded only by available memory.
BoundedRowIterator(comptime max_fields) #
/// Default maximum fields per row for the convenience wrapper.
pub const default_max_fields: usize = 64;
pub fn BoundedRowIterator(comptime max_fields: usize) type {
return struct {
const Self = @This();
field_iter: FieldIterator,
row_buf: [max_fields][]const u8 = undefined,
row_len: usize = 0,
pub fn init(
reader: *std.Io.Reader,
field_buf: []u8,
dialect: Dialect,
) Error!Self;
pub fn next(self: *Self) Error!?Row;
};
}
Returns error.RowTooWide if a row exceeds max_fields.
No deinit. Stack-stored. Use:
var field_buf: [4096]u8 = undefined;
var it = try csv.BoundedRowIterator(64).init(reader, &field_buf, .{});
while (try it.next()) |row| { ... }
FixedBufferRowIterator #
pub const FixedBufferRowIterator = struct {
field_iter: FieldIterator,
row_buf: [][]const u8,
row_len: usize = 0,
pub fn init(
reader: *std.Io.Reader,
field_buf: []u8,
row_buf: [][]const u8,
dialect: Dialect,
) Error!FixedBufferRowIterator;
pub fn next(self: *FixedBufferRowIterator) Error!?Row;
};
Returns error.RowTooWide if a row exceeds row_buf.len. No
deinit. Use when neither of the previous two variants fits, e.g.
the maximum column count is read from config at startup and you
still don't want to give the parser an allocator.
Convenience wrapper #
root.zig exposes csv.rows(reader, field_buf) as the
shortest-path entry point; it returns a
BoundedRowIterator(default_max_fields), requiring no allocator
and no column-limit decision from the caller.
HeaderIterator #
HeaderIterator wraps a RowIterator (the allocating variant) so
it inherits unbounded row width and needs no row-buffer parameter
from the caller. It uses its allocator only for the wrapped
RowIterator and for owned copies of the header strings.
pub const HeaderIterator = struct {
row_iter: RowIterator,
headers: [][]u8, // owned copies
allocator: Allocator,
strict_width: bool, // Story 3 #9; default false
pub const Options = struct {
dialect: Dialect = .{},
strict_width: bool = false,
};
pub const HeaderRow = struct {
fields: []const []const u8,
headers: []const []const u8,
pub fn at(self: HeaderRow, i: usize) ?[]const u8;
pub fn get(self: HeaderRow, name: []const u8) ?[]const u8;
pub fn count(self: HeaderRow) usize;
};
pub fn init(
reader: *std.Io.Reader,
field_buf: []u8,
allocator: Allocator,
opts: Options,
) Error!HeaderIterator;
pub fn deinit(self: *HeaderIterator) void;
pub fn next(self: *HeaderIterator) Error!?HeaderRow;
};
get(name) is a linear scan over headers. Rationale: typical CSVs
have under 100 columns; a linear scan is faster than a hash for that
range and avoids a second allocation. (Story 3 #2 permits "at most one
bookkeeping structure"; we choose not to use one here.) If profiling
ever shows otherwise this is an internal change with no API impact.
On duplicate headers, the linear scan naturally yields first-wins, satisfying Story 3 #7.
Table #
pub const Table = struct {
rows: [][]const []const u8, // owned
arena: std.heap.ArenaAllocator, // owns every byte the table holds
child_allocator: Allocator,
pub fn parse(
reader: *std.Io.Reader,
allocator: Allocator,
dialect: Dialect,
) Error!Table;
pub fn deinit(self: *Table) void;
};
Memory strategy. Table owns a std.heap.ArenaAllocator wrapping
the caller's allocator; all per-row and per-field allocations
(including copies of field bytes out of FieldIterator's borrowed
buffer) are made into the arena. This:
- makes
deinitO(1) and trivially leak-free, satisfying Story 4 #2; - guarantees that mid-parse failures (Story 4 #3) free everything via the same arena teardown — there is no per-allocation cleanup to get wrong;
- gives field data the same lifetime as the table, matching the documented contract.
parse drives a RowIterator (allocating variant) whose own storage
lives in the arena, copying each returned Row byte-for-byte into
the arena before requesting the next one (since Row.fields is
invalidated on the next call). A field_buf of initial 4 KiB is
also arena-allocated and grown as described under "FieldTooLong in
materialising tiers" below. Because RowIterator grows its own
row-slot buffer, Table inherits unbounded row width — there is no
RowTooWide failure mode here.
HeaderTable #
pub const HeaderTable = struct {
headers: []const []const u8,
rows: []const []const []const u8,
arena: std.heap.ArenaAllocator,
child_allocator: Allocator,
index: std.StringHashMapUnmanaged(usize), // header name -> column
pub const DuplicatePolicy = enum { error, first_wins, last_wins };
pub const WidthPolicy = enum { strict, permissive };
pub const Options = struct {
dialect: Dialect = .{},
on_duplicate: DuplicatePolicy = .error, // Story 5 #5
width: WidthPolicy = .permissive, // Story 5 #7
};
pub fn parse(
reader: *std.Io.Reader,
allocator: Allocator,
opts: Options,
) Error!HeaderTable;
pub fn deinit(self: *HeaderTable) void;
pub fn columnIndex(self: *const HeaderTable, name: []const u8) ?usize;
pub fn get(self: *const HeaderTable, row: usize, name: []const u8) ?[]const u8;
};
HeaderTable uses a StringHashMapUnmanaged here (unlike
HeaderIterator's linear scan) because random-access tables are
expected to receive many lookups across their lifetime, amortising the
hash-build cost. The map is built from headers after the parse and
lives in the arena.
The duplicate-handling pass walks headers in order:
first_wins: insert withgetOrPut, skip on collision.last_wins: overwrite on collision.error: returnerror.DuplicateHeaderon collision, after arena cleanup.
Width policy is checked per row as rows are appended; the first
mismatch under strict returns error.RowWidthMismatch (and
ArenaAllocator.deinit releases everything).
root.zig re-exports #
Public surface is unchanged in shape, plus the new option structs:
pub const Dialect = @import("dialect.zig").Dialect;
pub const Error = @import("error.zig").Error;
pub const Row = @import("row_iterator.zig").Row;
pub const FieldIterator = @import("field_iterator.zig").FieldIterator;
pub const RowIterator = @import("row_iterator.zig").RowIterator; // allocating
pub const BoundedRowIterator = @import("row_iterator.zig").BoundedRowIterator; // comptime cap
pub const FixedBufferRowIterator = @import("row_iterator.zig").FixedBufferRowIterator; // caller buffer
pub const default_max_fields = @import("row_iterator.zig").default_max_fields;
pub const HeaderIterator = @import("header_iterator.zig").HeaderIterator;
pub const Table = @import("table.zig").Table;
pub const HeaderTable = @import("header_table.zig").HeaderTable;
Convenience wrappers:
csv.rows(reader, field_buf)→BoundedRowIterator(default_max_fields)with default dialect (no allocator needed).csv.rowsAlloc(reader, field_buf, allocator)→ allocatingRowIteratorwith default dialect.csv.headerRows(reader, field_buf, allocator)→HeaderIteratorwith default options.csv.parseTable(reader, allocator)→Tablewith default dialect.
All return Error!T.
The FieldIterator state machine #
This is the heart of the library. The state machine consumes input one
byte at a time (logically; in practice we use the reader's buffer via
peek/take to amortise function calls) and emits one field per call
to next().
State transitions #
Notation: D = delimiter byte, Q = quote_char, \n/\r = line
endings. "emit(eor)" means return the accumulated field_buf[0..len]
with end_of_row = eor and reset len = 0.
| State | Byte / event | New state | Action |
|---|---|---|---|
start |
(init only) | field_start |
If dialect.strip_bom and peek(3) == EF BB BF, discardAll(3) |
field_start |
EOF (after at least one byte ever consumed by this iterator) |
eof |
If last_was_row_end == false → emit("", true); else return null |
field_start |
EOF (no bytes ever consumed) |
eof |
return null (correctness #7) |
field_start |
Q |
in_quoted |
(consume) |
field_start |
D |
field_start |
emit("", false) |
field_start |
\n |
field_start |
emit("", true); set last_was_row_end=true |
field_start |
\r then peek != \n |
field_start |
emit("", true); set last_was_row_end=true |
field_start |
\r\n |
field_start |
emit("", true); set last_was_row_end=true |
field_start |
other | in_unquoted |
append byte |
in_unquoted |
Q |
failed |
set pending_error = UnexpectedQuote |
in_unquoted |
D |
field_start |
emit(false); last_was_row_end=false |
in_unquoted |
line ending (any of \n, \r\n, bare \r) |
field_start |
emit(true); last_was_row_end=true |
in_unquoted |
EOF |
eof |
emit(true) |
in_unquoted |
other | in_unquoted |
append byte; check FieldTooLong |
in_quoted |
Q then peek == Q |
in_quoted |
append Q; consume the doubled quote (correctness #5) |
in_quoted |
Q then peek != Q |
after_quote |
(consume the closing quote) |
in_quoted |
EOF |
failed |
set pending_error = UnterminatedQuotedField |
in_quoted |
other (incl. \n, \r, D) |
in_quoted |
append byte; check FieldTooLong (correctness #4) |
after_quote |
D |
field_start |
emit(false); last_was_row_end=false |
after_quote |
line ending | field_start |
emit(true); last_was_row_end=true |
after_quote |
EOF |
eof |
emit(true) |
after_quote |
other | failed |
set pending_error = UnexpectedByteAfterQuote |
failed |
(any) | failed |
return pending_error.? |
eof |
(any) | eof |
return null |
A few notes:
- "Bare
\r" handling requires looking one byte ahead; we usereader.peekByte()(and accept itsEndOfStreamcleanly as "definitely not\n"). This is what was unavailable to thecount_enqueued.zigprototype and is what makes correctness #3 implementable without buffering. - We track
last_was_row_endinstead of just "did we emit anything" because correctness #9 (ignore final trailing newline) requires distinguishing "input ended at end-of-row" from "input ended mid-field". This is the smallest piece of state that gets both correctness #7, #8, and #9 right with the same code. FieldTooLongis checked on every byte that would be appended, before the append happens; the iterator is then placed infailedbut the input stream is left positioned just before that byte. This is the only documented soft-recovery case: a caller who grows the buffer and constructs a new iterator wrapped around the same reader could retry. We do not currently expose a "grow and retry" API at this tier — it's used internally byTable/HeaderTable(see below).
Reading strategy #
The state machine inspects input via reader.peekByte() /
reader.takeByte() for the structural bytes and uses
reader.peek(n) for the BOM check. For runs of plain unquoted /
in-quoted bytes we will also exploit reader.streamDelimiter /
peek+take(n) to copy chunks at a time into field_buf, avoiding
per-byte function-call overhead (N-8). The chunk path falls back to
the byte-at-a-time path whenever the next byte is structural.
This optimisation is an internal detail; correctness is defined by the byte-at-a-time table above and tested against it directly.
Sequence / data flow #
Example: parseTable consuming a,b\n1,2\n:
- Caller calls
csv.parseTable(reader, alloc). Table.parsevalidates a defaultDialect, creates anArenaAllocator(alloc), allocates an initial 4 KiBfield_bufinside the arena, and constructs aRowIteratorover the reader usingarena.allocator()for its row-slot buffer.Table.parsecallsrow_iter.next()in a loop.- For each returned
Row,Table.parse:- allocates
[][]const u8of lengthrow.count()in the arena, arena.allocator().dupes eachrow.fields[j]byte slice (the borrowed slice is invalidated on the nextrow_iter.next()),- appends the new row to a growing
ArrayListUnmanaged([][]const u8).
- allocates
- When
row_iter.next()returns null,Table.parsetoOwnedSlices the row list and returns. - On any error,
errdefer arena.deinit()frees everything in one shot.
HeaderTable.parse is identical except the first row is captured into
headers, a StringHashMapUnmanaged is built per DuplicatePolicy,
and each subsequent row is checked against the WidthPolicy before
append.
Error handling & edge cases #
Sticky failure after malformed input #
When FieldIterator detects UnexpectedQuote,
UnexpectedByteAfterQuote, or UnterminatedQuotedField, it sets
pending_error and moves to failed. Every subsequent next() call
returns the same error. This is the literal interpretation of
correctness #14 ("no undefined behaviour from continued use") and
gives callers a clear, idempotent failure signal.
RowWidthMismatch does not live in FieldIterator — it is enforced
at the header tier (because only that tier knows the expected width).
Tiers that enforce it use the same sticky-error pattern.
FieldTooLong in streaming vs materialising tiers #
-
Streaming tiers (
FieldIterator,RowIterator,HeaderIterator): surfaceFieldTooLongdirectly. The caller chose the buffer size; this is the documented failure mode. -
Materialising tiers (
Table,HeaderTable): we use a doubling retry. IfFieldIterator.next()returnsFieldTooLong, the tier doublesfield_buf(in the arena), constructs a freshFieldIteratorover the same reader, and re-drives. However, because the reader is forward-only, "retry on the same reader" doesn't actually rewind. Therefore the doubling must happen ahead of the failure:Table.parsestarts with a small initialfield_buf(4 KiB) but grows it whenever the previous row's largest field exceeded half its current size. This amortises buffer growth without ever needing to re-read.A
FieldTooLongreturned to aTablecaller therefore indicates a single field larger than an internal cap (default 16 MiB, configurable on theTable.Options); this protects against pathological inputs from consuming unbounded memory. Default cap rationale: large enough to handle any reasonable CSV cell; small enough that an accidentally-binary input fails fast.Open question O-1: confirm this is the desired behaviour vs. simply surfacing
FieldTooLongwith a caller-supplied buffer at theTabletier too.
Mid-parse failure leaves no leaks #
Table.parse and HeaderTable.parse use the pattern:
var arena = std.heap.ArenaAllocator.init(child_allocator);
errdefer arena.deinit();
// ... all allocations go through arena.allocator() ...
return .{ .arena = arena, ... };
A single errdefer is sufficient because the arena owns every
allocation made during parsing. Story 4 #3 is satisfied structurally.
Empty input vs single newline vs trailing newline #
These are the three correctness-test edge cases that catch off-by-one bugs. They are distinguished by the state machine as follows:
| Input | First next() |
Second next() |
Rows yielded |
|---|---|---|---|
"" (empty) |
null | — | 0 |
"\n" |
("", end_of_row=true) | null | 1 (one empty field) |
"a\n" |
("a", true) | null | 1 |
"a\nb" |
("a", true) | ("b", true) | 2 |
"a\nb\n" |
("a", true) | ("b", true) | 2 |
These are encoded as table-driven tests in
field_iterator.zig's test block; the same inputs are also run
through RowIterator and Table to confirm correctness #7–9.
Bare \r at end of input #
field_start / in_unquoted on \r peek ahead one byte; an EOF on
the peek is treated as "not \n", so the \r becomes a row
terminator and the next next() returns null (with last_was_row_end = true suppressing a phantom trailing empty row).
BOM stripping interaction with the empty-input case #
BOM stripping is performed lazily on the first next() call. If the
input is exactly EF BB BF and nothing else, the BOM is discarded,
last_was_row_end remains false, and the iterator immediately sees
EOF in field_start — which it must distinguish from "no bytes ever
consumed". We track this with a bytes_consumed: bool flag set
whenever any structural-or-payload byte is consumed (the BOM does not
count). So EF BB BF alone yields zero rows, same as "". This is
consistent with the requirements (the spec only mentions completely
empty input for correctness #7, but treating BOM-only as equivalent
matches user expectation).
Dialect validation timing #
Dialect.validate is called from every init that accepts a dialect.
InvalidDialect is part of Error and surfaces from init. The
existing stub's init returning a bare FieldIterator (no error
union) is therefore changed to return Error!FieldIterator. This
propagates through all tiers.
Testing strategy #
Per N-13 / N-14, the suite is structured as:
-
field_iterator.zigtests — the densest set. Table-driven tests where each row is(input_bytes, dialect, expected_fields, expected_error). Covers every entry in the state-machine transition table. Inputs include:- empty /
"\n"/"\r"/"\r\n"/ BOM-only; - one-field, two-field, ragged rows;
- quoted fields with embedded delimiter,
\n,\r,\r\n, doubled quote; - each malformed-input error;
- non-default dialect (tab, semicolon, alternative quote);
Dialectvalidation failures;- field exactly fills the buffer; field one byte too large.
- empty /
-
row_iterator.zigtests — exercise all three variants in parallel against a shared corpus of inputs to confirm they yield identicalRowvalues:RowIterator(allocating) understd.testing.allocatorso leaks fail the suite;BoundedRowIterator(4)to triggerRowTooWide;BoundedRowIterator(default_max_fields)for the common path;FixedBufferRowIteratorwith a 4-slot caller buffer to confirmRowTooWideand the externally-provided storage path.
-
header_iterator.zigtests — header capture, name lookup, missing-column null, duplicate-name first-wins, strict-width enabled and not,deinitreleases headers (verified withstd.testing.allocator's leak detector). -
table.zigtests — full round trips on representative inputs;deinitleak-free undertesting.allocator; mid-parse error leaves no leaks (forced by giving an input with anUnexpectedQuote); empty input yields zero rows. -
header_table.zigtests —columnIndex/gethappy paths; eachDuplicatePolicyvalue; eachWidthPolicyvalue; ragged-row acceptance underpermissive;RowWidthMismatchunderstrict. -
root.zigdoctests — one runnable example per tier (N-12).
All allocating tests use std.testing.allocator so leaks fail the
suite automatically — this is how we operationally enforce N-2 and
Story 4 #2/#3 without writing explicit leak assertions.
Out of scope for this feature (per N-15): fuzzing, golden files, throughput benchmarks. The state-machine table is the contract; the table-driven tests exercise it directly.
Open questions / trade-offs #
-
O-1.
Table's response to oversize fields: doubling field buffer with a configurable cap (current proposal) vs. surfacingFieldTooLongto the caller with a caller-supplied buffer at theTabletier. The former is friendlier for the "small config file" use case; the latter is more consistent with the streaming tiers' philosophy of "caller controls memory". Default: doubling with a 16 MiB cap, configurable onTable.Options. -
O-2. Linear scan in
HeaderIterator.getvs. building a map. Current proposal: linear scan. Trade-off described in theHeaderIteratorsection; cheap to revisit later without API impact. -
O-2a. Should
RowIterator(allocating) expose a configurable initial capacity for its row-slot buffer? Current proposal: no — start at 0 and letArrayListUnmanaged's growth strategy handle it. Cheap to revisit. -
O-3. The
Dialectonly validates against delimiter/quote collisions with each other and with\n/\r. Should we also reject e.g.\0or other control bytes? Current answer: no — the library is byte-oriented and the user might legitimately want odd delimiters (e.g. ASCII unit separator\x1F). -
O-4.
ErrorincludesUnknownHeaderbut no current API surfaces it — name lookups return optionals. The variant is reserved for a possible future strictgetRequiredaccessor. Acceptable to leave in for forward compatibility, or remove if we prefer a minimal error set right now.