A single Console IO type obscures direction and syscall descriptors.
Console I/O streams
Platform spec feature
Console I/O streams
Spec standingStandard
-
stdin/stdout/stderr use separate System modules.
Context
Decision
Rule Detail Modules System.Input,System.Output,System.ErrorForbidden Monolithic console IO type for standard streams Consequences
Each module binds one
StandardStreamdescriptor; cross-stream APIs stay separate.Verification anchors
packages/runtime/src/System/Input.bd,Output.bd,Error.bd. -
Syscall write failures panic; reads surface Result.
Context
v1 write helpers are infallible at the type level; read paths need explicit error handling.
Decision
Rule Detail Write Write/WriteLinemust panic onWriteWithfailureRead Read/ReadLinereturnResult<string, SyscallError>Consequences
Diagnostics for write failures use fixed panic strings; callers cannot catch write errors in Beskid v1.
Verification anchors
Corelib stream tests; syscall integration in
beskid_runtime. -
WriteLine appends a single LF byte sequence.
Context
Cross-platform hosts may translate line endings below the Beskid API.
Decision
Rule Detail Ending WriteLinemust append\nonlyWindows Host/platform layer may translate later without API change Consequences
Authors see consistent Beskid source semantics; CRLF is not encoded in corelib strings.
Verification anchors
Output.bd/Error.bdtests; platform IO docs.
- Contracts and edge cases MUST rules for standard stream reads, writes, and error handling.
- Design model Stream module boundaries and syscall descriptor model for standard I/O.
- Examples Standard stream read and write usage patterns.
- Flow and algorithm Read and write algorithms for standard stream helpers.
- Verification and traceability Runtime syscall and corelib anchors for standard stream I/O.
0 revisions (git unavailable at build; counts may be empty)
No commits recorded for this path.
| Section id | Required | Found |
|---|---|---|
what-this-feature-specifies | yes | yes |
implementation-anchors | yes | yes |
Full tree: run pnpm verify:platform-spec-layout (writes src/generated/platform-spec-layout-report.json).
What this feature specifies
Split standard stream helpers in corelib_runtime: System.Input (stdin), System.Output (stdout), and System.Error (stderr). All traffic uses System.Syscall.ReadWith / WriteWith with typed Descriptor::Standard(StandardStream::*) selectors—no direct fd integers in user code.
Contract statement
| Stream | Module | Syscall descriptor | Read | Write |
|---|---|---|---|---|
| stdin | System.Input | Stdin | Read, ReadLine → Result<string, SyscallError> | Not supported |
| stdout | System.Output | Stdout | Not supported | Write, WriteLine |
| stderr | System.Error | Stderr | Not supported | Write, WriteLine |
- Encoding at the boundary is UTF-8 bytes of the Beskid
stringtype. WriteLinemust write the text then a single"\n"line feed (corelib policy; not CRLF unless host translates).Write/WriteLinefailures fromWriteWithmust panic with__panic_str("System.Output.Write failed")or the stderr equivalent—there is noResulton write helpers in v1.- ANSI and markup must not be interpreted in these modules; escape bytes are ordinary string contents (see ANSI escape model).
Implementation anchors
compiler/corelib/packages/runtime/src/System/Input.bd,Output.bd,Error.bdcompiler/corelib/packages/runtime/src/System/Syscall/- Informative module docs:
compiler/corelib/beskid_corelib/docs/System/Input.md,Output.md,Error.md
Decisions
Section titled “Decisions”No open decisions. Closed choices are normative ADRs under adr/ (D-CORE-TERM-0010 … D-CORE-TERM-0012); use the reader ADRs tab for expandable detail.
Articles
- Split stream modules per fdstdin/stdout/stderr use separate System modules.
- Contracts and edge casesMUST rules for standard stream reads, writes, and error handling.
- Design modelStream module boundaries and syscall descriptor model for standard I/O.
- ExamplesStandard stream read and write usage patterns.
- Flow and algorithmRead and write algorithms for standard stream helpers.
- Verification and traceabilityRuntime syscall and corelib anchors for standard stream I/O.