lib/memio: wire seeker (io.seek dispatch landed; #5-era deferral stale)

io.error grows errors.invalid (ref/hare/io/types.ha:11 spreads
...errors::error, which includes it; Hare's memio seek returns it on
out-of-bounds, stream.ha:134-136) — appended last so existing member
tags stay put; no exhaustive io.error matches exist in lib.

seekfn mirrors ref/hare/memio/stream.ha:122-140 over the flat header,
shared by fixed/dynamic/dynamicfrom (Hare wires the same seek into
both vtables). The io.off-vs-i64 arithmetic runs on an i64 copy:
cstage binop typing is nominal on aliases, wwstage accepts (filed,
ww-core #54).

791's stream_seek_unsupported row re-pins st_seek's void-arm on a
hand-built seekerless vtable: its old premise (memio wires no seeker)
is retired by this commit; memio seek success is pinned by memiotest.

w6c/wwdump main.combined.ww regen'd: they embed lib/io + lib/memio
(the freshness gates are blind to this — embedded-source discipline);
w6a/w6l/ww don't embed io, verified untouched.
This commit is contained in:
2026-06-04 15:49:25 +09:00
parent bc048ebe65
commit 532b0a88ae
6 changed files with 365 additions and 31 deletions

View File

@@ -10,9 +10,10 @@
// resolve via the dir-enum concat order (io.ww < stream.ww < types.ww
// — `stream` lands before the reader/writer/closer aliases below).
//
// Deferrals (drew-signed): `handle`, `seeker`, `copier`, `strerror`
// land with io fold-2 (#5; need the `handle` sum). Hare's `EOF = done`
// stays as `io.eof` until the `done` singleton ships (#93).
// Deferrals (drew-signed): `copier`, `strerror` (the #5 list's
// `handle` + `seeker` landed with the #5 arc and the memio-seeker
// port). Hare's `EOF = done` stays as `io.eof` until the `done`
// singleton ships (#93).
package io;
@@ -58,8 +59,11 @@ export type handle = (file | stream);
// layout mismatch; #199b layout-extension is the deferred fix). The
// read/write dispatchers in stream.ww return `errors.unsupported`
// when the matching vtable slot is unset, so the variant lands here
// directly.
export type error = !(errors.unsupported | underread | nomem);
// directly. `errors.invalid` rides the memio-seeker port (Hare's
// memio seek returns errors::invalid on out-of-bounds,
// ref/hare/memio/stream.ha:134-136); appended last so existing
// member tags stay put.
export type error = !(errors.unsupported | underread | nomem | errors.invalid);
// ref/hare/io/types.ha:46. `eof` (not Hare's `done`) per the io.ww
// rationale; lifts to `done` with #93. `stream` forward-refs the