lib: collapse the parallel vstream scaffold onto the single Hare io surface (#94 fold-eFinal)

The Option-C parallel _v vstream API was scaffolding to bring the io stack up alongside the old surface; carrying both permanently is a rule-9 divergence from ref/hare, which has exactly one io surface. Collapse onto that surface (stream = *vtable, ref/hare/io/stream.ha) and rename the _v symbols to their Hare names (io vstream->stream, fmt vfprint->fprint, bufio/memio/log surfaces, log.new). Deletes the 4 lib/*/vstream.ww scaffold files; regenerates w6c/wwdump combined.ww. cstage and wwstage stay byte-identical and combined_ww_fresh holds; all 220 tests pass.
This commit is contained in:
2026-05-30 03:24:23 +09:00
parent 80184a3acf
commit 7d39f6d623
31 changed files with 2371 additions and 4834 deletions

View File

@@ -1,19 +1,17 @@
// types — error union, mode/whence enums, reader/writer/closer
// fn-type aliases. Project #94 fold-1 step (d) (drew Fold D); the
// fn-aliases re-targeted from *stream → vstream as part of fold-e1
// (vtable port in stream.ww).
// fn-type aliases. Project #94 fold-eFinal; the fn-aliases target
// `stream` (= `*vtable`, the single io surface).
//
// Hare splits the io module across stream.ha + types.ha and ww does
// the same: lib/io/io.ww owns the (pre-vtable) `stream`, `eof`, and
// `underread` shapes; lib/io/stream.ww owns the Hare vtable port
// (`vtable`, `vstream`, `st_read`/`st_write`/`st_close` dispatch);
// this file owns the surrounding port. The three files share
// `package io;` so cross-file refs resolve via the dir-enum concat
// order (io.ww < stream.ww < types.ww — `vstream` lands before the
// reader/writer/closer aliases below).
// the same: lib/io/io.ww owns the `eof` and `underread` tags;
// lib/io/stream.ww owns the vtable surface (`vtable`, `stream`,
// `read`/`write`/`close` dispatch); this file owns the surrounding
// port. The three files share `package io;` so cross-file refs
// 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 fold-e2+ (need the `handle` sum). Hare's `EOF = done`
// land with io fold-2 (#5; need the `handle` sum). Hare's `EOF = done`
// stays as `io.eof` until the `done` singleton ships (#93).
package io;
@@ -43,20 +41,20 @@ export type whence = enum i32 {
// ww enumerates the tags explicitly (ken's #204-block — spread of an
// errors-side tagged into this union triggers a wrapper-vs-flatten
// layout mismatch; #199b layout-extension is the deferred fix). The
// st_read/st_write dispatchers in stream.ww return
// `errors.unsupported` when the matching vtable slot is unset, so the
// variant lands here directly.
// 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);
// ref/hare/io/types.ha:46. `eof` (not Hare's `done`) per the io.ww:8
// rationale; lifts to `done` with #93. `vstream` forward-refs the
// 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
// `*vtable` alias in stream.ww — the dispatcher receives the vtable
// pointer directly (Hare's stream.ha:33 + types.ha:46 collapse).
export type reader = fn(s: vstream, buf: []u8) (size | eof | error);
export type reader = fn(s: stream, buf: []u8) (size | eof | error);
// ref/hare/io/types.ha:51. No `const` qualifier — ww has none, and
// lib/io/io.ww:30 + lib/sort/sort.ww:18 drop it the same way.
export type writer = fn(s: vstream, buf: []u8) (size | error);
// lib/sort/sort.ww:18 drops it the same way.
export type writer = fn(s: stream, buf: []u8) (size | error);
// ref/hare/io/types.ha:55.
export type closer = fn(s: vstream) (void | error);
export type closer = fn(s: stream) (void | error);