the.bay.news

What do you think about Io.print/Io.println for stdout and Io.readLine/Io.readAlloc for stdin

Ziggit
What do you think about Io.print/Io.println for stdout and Io.readLine/Io.readAlloc for stdin
Printing to stdout and reading lines from stdin are the most common I/O operations in CLI programs, yet they currently require several lines of ceremony. It would be great to avoid that and instead add four helper functions to “Io”: pub fn print(io: Io, comptime fmt: []const u8, args: anytype) File.Writer.Error!void { var buf: [1024]u8 = undefined; var w = File.stdout().writer(io, &buf); try w.interface.print(fmt, args); try w.flush(); } pub fn println(io: Io, comptime fmt: []c...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.