Initial import: Aji 0.1 draft spec and Zig scaffolding

Draft specification, RFCs, reference registries and examples, plus the
reference-implementation skeleton: build.zig, diagnostic envelope with
error-code registry synced to docs, aji CLI, conformance runner with seed
tests, CI and contributor docs.
This commit is contained in:
dev committed 2026-10-04 11:59:13 +03:00
commit 17a55a7fef
67 files changed
+4197

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
module examples.file_copy;
fn copy(
fs_read: cap<fs.read>,
fs_write: cap<fs.write>,
src: slice<u8>,
dst: slice<u8>,
alloc: cap<mem.alloc>
) -> Result<void, IoError>
effects [mem.alloc, fs.read, fs.write]
{
let input = fs.open_read(fs_read, src)?;
defer fs.close(move input);
let output = fs.open_write(fs_write, dst)?;
defer fs.close(move output);
var region = region.create(alloc, limit = 64 KiB)?;
defer region.destroy(move region);
let buffer = region.alloc_zeroed_array<u8>(mut region, 64 KiB)?;
while true {
let n = fs.read(ref input, buffer)?;
if n == 0 {
break;
}
fs.write_all(ref output, slice.prefix(buffer, n))?;
}
return Ok();
}