louise
The Louise language: compiler, runtime, std, tooling
Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.
Dernier runRéussi#125 · main · 16 min 13 s
0Étoiles
0Forks
40Issues
| 1 | import std/io |
| 2 | |
| 3 | // A multi-shot `resume` called while its handler's body runs panics on |
| 4 | // both backends: natively, the body's stack is in use (ADR 0017). |
| 5 | |
| 6 | type K { K(fn(K) -> Int / <io>) } |
| 7 | |
| 8 | effect amb |
| 9 | { |
| 10 | multi ctl fork :: -> K |
| 11 | } |
| 12 | |
| 13 | pub fn main :: -> () / <io> |
| 14 | { |
| 15 | let n = handle |
| 16 | { |
| 17 | let K(k) = fork () |
| 18 | io.println "resuming from inside the body" |
| 19 | k K(k) + 1 |
| 20 | } |
| 21 | with |
| 22 | { fork -> resume K(resume) } |
| 23 | io.println ("not reached " <> show n) |
| 24 | } |
| 25 | //> resuming from inside the body |
| 26 | //! panic: `resume` called while its handler's body is running |