rfc: 0007 revision 2, remaining examples and diagnostics note

This commit is contained in:
dev committed 2026-10-04 13:51:32 +03:00
1 parent 67b228e547
commit c7bcea294e
1 file changed
+12 -4
+12 -4
View File
@@ -218,15 +218,23 @@ Run: `aji run --grant out=io.write hello.air` → `{"status":"returned","value":
```text
intrinsic fs.open_read(%c, %p), ok -> @opened, err -> @fail
opened(%f: file):
opened(%f: file<read>):
ret ; E3002: %f is never closed
```
```text
opened(%f: file):
opened(%f: file<read>):
intrinsic fs.close(%f), ok -> @a, err -> @b
a:
%m = borrow.mut %f ; E3001: %f was closed
b(%e: io_error):
intrinsic fs.close(%f), ok -> @c, err -> @d ; E2002: closed on the err edge too
```
```text
opened(%f: file<read>):
%m = borrow.mut %f
intrinsic fs.write_all(%m, %s), ok -> @a, err -> @b ; E1001: needs mut<file<write>> or mut<file<append>>
```
```text
@@ -234,12 +242,12 @@ a:
```
```text
type @Log = struct { f: file } ; E0006: needs feature linear_aggregates
type @Log = struct { f: file<append> } ; E0006: needs feature linear_aggregates
```
## Diagnostics
Existing codes now specified for resources: `E2001`, `E2002`, `E3001`, `E3002` (§1.3), `E3201` (wrong capability kind for an intrinsic), `E3101` (intrinsic effect). New built-in enum `io_error`. No new codes.
Existing codes now specified for resources: `E2001`, `E2002`, `E3001`, `E3002` (§1.3), `E3201` (wrong capability kind for an intrinsic), `E3101` (intrinsic effect). New built-in enum `io_error`. No new codes. New environment outcome `blocked` (exit code 7).
## Compatibility