hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit cf96500f043af7615dd9324a16baf3663ceaab73
parent 7674d856c5378b45a7f981e937e7d0099663fd91
Author: Drew DeVault <sir@cmpwn.com>
Date:   Thu, 25 Feb 2021 17:16:28 -0500

io::println, errorln: accept multiple arguments

Diffstat:
Mio/println.ha | 20++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/io/println.ha b/io/println.ha @@ -1,12 +1,24 @@ use rt; // TEMP: This is due to be rewritten to be less shit -export fn println(msg: str) void = { - rt::write(1, msg: *const char, len(msg)); +export fn println(msgs: str...) void = { + for (let i = 0z; i < len(msgs); i += 1) { + let msg = msgs[i]; + rt::write(1, msg: *const char, len(msg)); + if (i + 1 < len(msgs)) { + rt::write(1, " ": *const char, 1); + }; + }; rt::write(1, "\n": *const char, 1); }; -export fn errorln(msg: str) void = { - rt::write(2, msg: *const char, len(msg)); +export fn errorln(msgs: str...) void = { + for (let i = 0z; i < len(msgs); i += 1) { + let msg = msgs[i]; + rt::write(2, msg: *const char, len(msg)); + if (i + 1 < len(msgs)) { + rt::write(2, " ": *const char, 1); + }; + }; rt::write(2, "\n": *const char, 1); };