Goal: provide a common Reader/Writer interface surface so console, file, and network APIs can be used through one call pattern (similar to Go’s io.Writer usage style).
- define
std/iocore interfaces:Reader(Read(&mut self, buf: []u8) i32)Writer(Write(&mut self, buf: []u8) i32)Closer(Close(&mut self) void)ReadWritercomposition pattern
- define common helper funcs in
std/io:WriteAll(w: Writer, buf: []u8) i32ReadAtLeast(r: Reader, buf: []u8, min: usize) i32Copy(dst: Writer, src: Reader, scratch: []u8) i32
- confirm receiver form consistency (
&selfvs&mut self) for interface implementers.
- add
std/osadapters:Stdout(),Stderr(),Stdin()concrete types implementingWriter/Reader
- add
std/fsfile handle type implementingReader/Writer/Closer - add
std/netsocket/conn baseline implementingReader/Writer/Closer(afterstd/io+std/fsstability)
Current runtime is centralized in runtime/ferret_runtime.c/h.
- split runtime by concern while keeping one public include boundary:
runtime/ferret_runtime.h(public surface)runtime/ferret_alloc.cruntime/ferret_io_stdio.cruntime/ferret_io_file.cruntime/ferret_net.c(optional/phase-2)
- keep naming/mangling stable for Ferret stdlib extern linkage.
- ensure build scripts include new runtime units for both LLVM and QBE flows.
- verify interface dispatch for
&mut selfmethods with slice params. - verify extern linking for new stdlib/runtime symbols across module paths.
- add minimal diagnostics when an interface method receiver shape mismatches implementation.
- add smoke:
io_writer_smoke.fer(single API call works with stdout writer) - add smoke:
io_file_smoke.fer(write/read/close roundtrip viastd/fs) - add smoke:
io_copy_smoke.fer(copy stdin/file/network-like reader->writer) - run backends:
ferret -backend llvm ...ferret -backend qbe ...
- one
WriteAllpath works unchanged for stdout and file. - one
Copypath works for two different concrete implementations. - no backend-specific behavior divergence in smoke suite.
- docs updated in
supported.md+ language/runtime notes.