diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2026-05-01 22:43:13 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2026-05-01 22:43:13 +0300 |
| commit | db3809488805fbdcd9d726d9ed45ad7335812bd1 (patch) | |
| tree | dcf1ceb68a7d77733a474825a9804fe99d253b48 /examples/own.fwd | |
| parent | f1e9860ab638594e95db0ada848157b860eeb831 (diff) | |
| download | fwd-db3809488805fbdcd9d726d9ed45ad7335812bd1.tar.gz fwd-db3809488805fbdcd9d726d9ed45ad7335812bd1.zip | |
+ Might come up with proper examples at some point, but for now tests at
least tell us if they're broken
Diffstat (limited to 'examples/own.fwd')
| -rw-r--r-- | examples/own.fwd | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/examples/own.fwd b/examples/own.fwd deleted file mode 100644 index 6634886..0000000 --- a/examples/own.fwd +++ /dev/null @@ -1,33 +0,0 @@ -do_something((auto) a); -consume(auto a); - -main() -{ - do_something() => auto a; - do_something() => auto b; - !> e { - /* if do_something() fails, a is still alive, so we must kill - * it. However, we might enter this error block after the - * callback to do_something() was run, and a might've already - * been moved. own just checks if we still own the resource and - * executes the block. - * - * admittedly, purely syntactically it would look like b is - * already alive at this point, but since it's actually within - * the implicit closure, it is not. Might play around with ordering - * the error block to come before implicit closures... - */ - own a {consume(a);} - error e - } - - consume(a); - !> e { - /* if consume fails, b is still alive, but either this error - * block runs (and throws an error) or the next consume is run, - * so own is not necessary here */ - consume(b); - error e - } - consume(b); -} |
