From 4212ad23e5dd6b84ceda32e9a4997a8e57bdae3c Mon Sep 17 00:00:00 2001 From: Akuli Date: Mon, 23 Jan 2023 02:08:16 +0200 Subject: [PATCH] Use import statements in doc/perf.md (#95) --- doc/perf.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/doc/perf.md b/doc/perf.md index 366c5b52..bed9738d 100644 --- a/doc/perf.md +++ b/doc/perf.md @@ -36,7 +36,7 @@ int main() ```python # fib40.jou (Jou program) -declare printf(format: byte*, ...) -> int +from "stdlib/io.jou" import printf def fib(n: int) -> int: if n <= 1: @@ -199,8 +199,7 @@ TODO: write this section once a large Jou program exists and name it Example #1 Let's write a program that crashes if the user selects yes. ```python -declare printf(msg: byte*, ...) -> int -declare getchar() -> int +from "stdlib/io.jou" import printf, getchar def main() -> int: printf("Crash this program? (y/n) ") @@ -242,9 +241,8 @@ Essentially it thinks that the `x = *foo` code will never run, because you aren' Sidenote: if you want the program to crash with optimizations on, then you should do so using `abort()` function for example: ```python -declare printf(msg: byte*, ...) -> int -declare getchar() -> int -declare abort() -> void +from "stdlib/io.jou" import printf, getchar +from "stdlib/process.jou" import abort def main() -> int: printf("Crash this program? (y/n) ")