Tour · 22 of 25
A function that can wait says so with !, and so does every call to it
A call that waits, for a timer, a disk, or a server, is a point where other
work can run and the world can change. In hd such a function's name ends in
!, and so does each call that waits for it, so you can spot every pause
point by reading. Like ?, the mark travels up: a function that makes a !
call must be a ! function itself. Writing the call without !, as in
fetch_orders(user), does not run it yet; all! takes such calls, runs them
as tasks, and waits until all are done. Reading a file or a line of input is
such a wait, so a program that does I/O through a ! call starts at main!.
A plain main that calls read_line!() is an error: only a ! function may make a ! call. The clock is provided, so a test can
use a fake one.
Run: Ctrl+Enter · Pages: Alt+← Alt+→