summaryrefslogtreecommitdiff
path: root/lib/std/die.myr
diff options
context:
space:
mode:
Diffstat (limited to 'lib/std/die.myr')
-rw-r--r--lib/std/die.myr19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/std/die.myr b/lib/std/die.myr
new file mode 100644
index 0000000..87135f1
--- /dev/null
+++ b/lib/std/die.myr
@@ -0,0 +1,19 @@
+use "syswrap.use"
+use "types.use"
+
+pkg std =
+ $noret const die : (msg : byte[:] -> void)
+ const assert : (cond : bool, msg : byte[:] -> void)
+;;
+
+const die = {msg
+ write(2, msg)
+ suicide()
+}
+
+const assert = {cond, msg
+ if !cond
+ die(msg)
+ ;;
+}
+