diff options
| author | 2026-10-15 17:50:10 +0330 | |
|---|---|---|
| committer | 2026-10-15 17:50:10 +0330 | |
| commit | 251b0212f626d0f92eda51906d353712ef4a63b8 (patch) | |
| tree | 4f0e0b0ee6b0f6d0671261a46bb2bcd15ef0f59c /src/lib/std.zc | |
| parent | merge work/actors: wasm seed bootstrap (seed/MANIFEST), shared copy-on-write ... (diff) | |
| parent | prescan: guess an owned return only from a local declared from new/heap, not ... (diff) | |
merge work/demo-fixes: analyzer ownership fixes (back links, loop-built lists, .u inference), Io.print any args, block-end borrow messages
Diffstat (limited to 'src/lib/std.zc')
| -rw-r--r-- | src/lib/std.zc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/lib/std.zc b/src/lib/std.zc index b206888..5c86aa6 100644 --- a/src/lib/std.zc +++ b/src/lib/std.zc @@ -421,15 +421,16 @@ struct Host { // called as std.Io.name(args). the writers go through rt.put_c, so a capture // (std.capture) sees their text too. the rt names (rt.put_n, rt.put_s and the // rest) stay; these are the same operations, grouped with the library. -// zc has no varargs or overloading, so print takes a string, and numbers have -// their own writers: std.Io.print("n = "); std.Io.put_n(n); std.Io.nl(); +// print and println take any mix of strings, byte strings, numbers and floats, +// each written by its type: std.Io.println("n = ", n, ", x = ", x); struct Io { - // writes a string. - // s: the text + // writes its arguments in order: any mix of strings, byte strings, numbers + // and floats (the compiler picks the writer for each argument's type). + // s: the first value; more may follow // returns: 0 static int print(char* s) { return rt.put_s(s); } - // writes a string and a line break. - // s: the text + // writes its arguments like print, then a line break. no arguments: just the line break. + // s: the first value; more may follow // returns: 0 static int println(char* s) { rt.put_s(s); return rt.put_c(10); } // writes a line break. |
