aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorGravatar zinc <zinc@downsta.ir> 2026-10-15 15:00:36 +0330
committerGravatar zinc <zinc@downsta.ir> 2026-10-15 15:00:36 +0330
commita5a5029a80a14be46c244b5bcca63e5e2cd9026f (patch)
tree9ba84a7d2c5c0f8bdbba65eb9df57b6129c132e7 /src/lib
parentTODO: implicit namespace at the top (diff)
std.Io.print/println take any mix of printable arguments (compiler expands per type); docs, conformance
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/std.zc13
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.