I don't understand the comment in the method print_point in the class Point of the tutorial.<p><pre><code> [...]
# This function is declared as `async` because it
# awaits the result of print.
async fn print_point(p) {
# [...]
print("The point is: {p}").await
}
[...]
</code></pre>
From the first page of the tutorial:<p>> Dada, like JavaScript, is based exclusively on async-await. This means that operations that perform I/O, like print, don't execute immediately. Instead, they return a thunk, which is basically "code waiting to run" (but not running yet). The thunk doesn't execute until you await it by using the .await operation.<p>So, what it boils down to is that async/await are like lazily computed values (they work a bit like the lazy/force keywords in Ocaml for instance, though async seems to be reserved for function declarations). If that is the case, that method "print_point" is forcing the call to print to get that thunk evaluated. Yet, the method itself is marked async, which means that it would be lazily evaluated? Would it be the same to define it as:<p><pre><code> fn print_point(p) {
print("The point is: {p}")
}
</code></pre>
If not, what is the meaning of the above? Or with various combinations of async/await in the signature & body? Are they ill-typed?<p>I wish they'd provide a more thorough explanation of what await/async means here.<p>Or maybe it is a dadaist[0] comment?<p>[0] <a href="https://en.wikipedia.org/wiki/Dada" rel="nofollow">https://en.wikipedia.org/wiki/Dada</a>