Phase 6A: .aji layer 6 (intrinsics, resources, narrowing, unsafe operations)
- intrinsics from the registry as plain calls: fallible ones are outcome matches or `or trap` (E7006 otherwise), infallible ones plain calls - resource operands by name, borrowed mut for the one operation and ended on every edge; a mut binding/parameter passes as is; `mut f` is E7006 - closes consume with `move` (E7003); no inserted closes (E3002/E3001) - data operands explicit (ref/mut/byte string, E7005 otherwise) - file<…>, stream, listener types; cap.narrow.prefix with cap_error edges - ref/mut unchecked s[i] (also as a binding) and assume(c) under effects [unsafe]; boundary left to the verifier (E6001) - trusted is reserved and rejected (E7006) - parameter names preserved; generated names avoid them (normative) - parser: >> closes two type arguments - conformance: `equivalent:` compares the run record with a reference AIR program (hello, file_copy, tcp_echo, narrow ok/not_subset/invalid, random) - spec 15, grammar, quick reference (io_error match fixed), plan, examples
This commit is contained in:
1 parent
bdcf871e5d
commit
c18fb7acc1
39 files changed
+1309
-69
No files matched your search
@@ -0,0 +1,32 @@
|
||||
// A missing file: err(e) binds the io_error, matched like any closed enum.
|
||||
// expect: run
|
||||
// grant: src=fs.read:/in
|
||||
// result: 1
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md
|
||||
module demo.ioerror
|
||||
|
||||
fn main(src: cap<fs.read>) -> u8
|
||||
effects [fs.read]
|
||||
{
|
||||
match fs.open_read(src, b"/in/missing.txt") {
|
||||
ok(f) => {
|
||||
fs.close(move f) or trap;
|
||||
0
|
||||
}
|
||||
err(e) => match e {
|
||||
io_error::not_found => 1,
|
||||
io_error::permission_denied => 2,
|
||||
io_error::already_exists => 3,
|
||||
io_error::invalid_input => 4,
|
||||
io_error::no_space => 5,
|
||||
io_error::broken_pipe => 6,
|
||||
io_error::connection_refused => 7,
|
||||
io_error::connection_reset => 8,
|
||||
io_error::address_in_use => 9,
|
||||
io_error::address_unavailable => 10,
|
||||
io_error::timed_out => 11,
|
||||
io_error::other => 12,
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user