tobogganSe connecter

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.

26 lignes · 548 octetsBrut · Historique
1import 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
6type K { K(fn(K) -> Int / <io>) }
7
8effect amb
9{
10 multi ctl fork :: -> K
11}
12
13pub 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