Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
1bdc2ca
Test buffer to_string
Jan 2, 2026
1691fcb
Document stdlib and add code browser tool
Jan 2, 2026
6186c87
Add stdlib docs and docstring browser
Jan 2, 2026
16f664a
Limit code browser to stdlib docs
Jan 2, 2026
324a65b
Fix code browser stdlib scan
Jan 2, 2026
be06fc1
Replace u8 literals with char literals
Jan 2, 2026
b55bd45
Add Option and enum payload codegen
Jan 2, 2026
4e497a4
Add payload enum tests
Jan 2, 2026
e31106c
Add substring search helpers
Jan 2, 2026
028acc3
Migrate stdlib Vec to Vec<T>
Jan 2, 2026
fdc065b
Add Vec<T> helper tests
Jan 2, 2026
43ee092
Add buffer/vec helper methods and tests
Jan 2, 2026
1290392
Replace Buffer with Text and Vec<u8>
Jan 2, 2026
bd651b0
Document Text and add tests
Jan 2, 2026
79f2ff0
stdlib: thread alloc through fs APIs
Jan 3, 2026
dc098ab
Refactor slices to pure Cap structs
Jan 3, 2026
edfd99a
Document string and slice ownership model
Jan 3, 2026
fff1c72
Add unsafe memcpy/memmove and slice escape checks
Jan 3, 2026
72ccc42
Close TODO-memory type and ABI gaps
Jan 3, 2026
1de8350
Close TODO-memory slice escape checks
Jan 3, 2026
541081b
Add memory work summary
Jan 3, 2026
a236eec
Expand memory model documentation
Jan 3, 2026
25d54b1
Add slice range helpers and vec/text ergonomics
Jan 3, 2026
143b037
Add substring helpers and Text alloc ergonomics
Jan 3, 2026
9b448de
Add Text slicing and update examples
Jan 3, 2026
84d5636
Panic on out-of-bounds slice access and add string guide example
Jan 3, 2026
5aa089b
Fix how to string demo
Jan 3, 2026
92120d4
Rewrite tutorial
Jan 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ target/
.hermit/
vscode/node_modules/
vscode/package-lock.json
docs/code-browser/index.html
docs/code-browser/files/
6 changes: 6 additions & 0 deletions FIXME.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,9 @@ Fixes applied from review:
- Support sret lowering in runtime wrapper emission to avoid ABI mismatches.
- Use return lowering in `try` error path to avoid returning wrong signature.
- Initialize zero values for non-opaque structs to avoid null deref when building Result payloads.

Current known issues/workarounds:

- Result<*T> still trips a typechecker mismatch (Param vs Path) in some generic
cases. Workaround: sys.vec allows limited arithmetic on type params so Vec<T>
can compute sizes; see tests/programs/result_ptr_generic.cap for coverage.
27 changes: 27 additions & 0 deletions TODO-MEMORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
TODO-MEMORY

1) Make Alloc real in runtime
- Done: all allocating runtime paths take an Alloc handle and use it for
malloc/free; current backend is libc, but the ABI keeps alloc explicit.

2) Fix Result<*T> typechecker bug
- Done: type equivalence treats type params vs unqualified paths consistently
in enum payload matching and Ok/Err checks.

3) Remove remaining runtime Vec intrinsics
- Done: runtime Vec tables removed; Vec/Slice operations are pure Cap.

4) Owned string and slice memory model
- string is a view over Slice<u8>; Text is owned Vec<u8>.
- Done: Safe non-stdlib modules may not return or store Slice/MutSlice to reduce
use-after-free hazards until a real lifetime model exists.
- Done: typecheck coverage for slice returns and struct/enum fields.

5) Unsafe pointer API completeness
- Done: memcpy/memmove added to sys::unsafe_ptr and lowered in codegen.
- Done: ptr_is_null/ownership expectations documented.

6) ABI + lowering docs update
- Done: opaque structs lowered to handles, field access is special-cased
in codegen, sret + ResultOut behavior, alloc-passing convention, and
Slice/string layout.
2 changes: 1 addition & 1 deletion TODO.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Done:
- Result<T, E> + is_ok/is_err/ok/err/unwrap_* implemented in stdlib (panic uses never type).
- Stdlib APIs updated to use Vec<T> (compiler maps Vec<u8>/Vec<i32>/Vec<string> to VecU8/VecI32/VecString).
- Stdlib uses Vec<T> directly (u8/i32/string supported).
- Codex reviewed Claude-generated commits.
966 changes: 824 additions & 142 deletions capc/src/codegen/emit.rs

Large diffs are not rendered by default.

Loading