Nocter v0.2.0 Development Contract
Purpose
v0.2.0 makes variable-length data safe to own in Nocter and exposes the same semantic information to editors. At completion, String and Vec<T> are practical APIs built on a shared Allocator and ownership foundation rather than demonstration-only implementations.
This document is the sole definition of the v0.2.0 milestone. Because v0 is ambiguous, it is not used as shorthand for a release name. Past releases remain in Git and release metadata rather than being mixed into the current design documents.
The release is 0.2.0 for arm64-darwin. Public language rules follow the specification.
Completion Definition
v0.2.0 is complete only when all four areas below are satisfied.
1. Allocator
Layoutcentralizes size, alignment, overflow, and zero-sized allocation rules.- Allocation, growth, and deallocation use one
Allocatorcontract;StringandVec<T>do not call OS page primitives directly. - Growth allocates and transfers content before freeing the old region. Failure preserves the old value.
RawBufferretains allocator provenance and actual allocation layout, and invalid values cannot be constructed through public APIs.- Runtime tests fix capacity arithmetic overflow, excessive alignment, allocation failure, and freeing empty values.
- Allocators are passed explicitly; v0.2.0 does not introduce an implicit global allocator.
2. Ownership and Destruction
- Recursive partial-initialization state is representable for structs, fixed arrays, and payload enums.
- A fixed array tracks its completed prefix separately from the current element under construction. If nested initialization of that element fails, acquired resources are destroyed exactly once in reverse order.
Vec<T>owns[0, len)and drops non-copy elements in reverse order.pushpublisheslenonly after element construction;clearanddropdestroy every element exactly once.poptransfers ownership of the final element to its return value and shrinks the vector-owned range by one.- Normal return, early
?, branches, loop exits, replacement, and partial-initialization failure all apply the same drop rules. - Unsupported ownership shapes receive a source-backed diagnostic before reaching IR or backend.
3. Standard Library Runtime
Stringempty, from/copy, reserve, push, clear, view, and drop work on the shared Allocator.Vec<T>empty, with_capacity, from_slice, reserve, push, pop, clear, view, and drop work for copy and non-copy elements where defined.- Build/run tests cover at least
Vec<String>,Vec<File>, andVec<Vec<String>>across growth, early return, clear, and scope exit without double-free, leaks, or use-after-move. - The packaged
.nocter/stdand repository-localdevelopment/stdexpose the same behavior. - Runtime primitives remain inside the narrow
pub(nocter)trust boundary; ordinary APIs are not compiler-name special cases.
See Standard Library.
4. LSP
- Diagnostics, semantic tokens, definition, references, and document symbols use the same compile-unit facts for open documents and imports.
- Hover returns declaration kind, complete type or signature, generic specialization, documentation, and ownership capability with a source-backed range.
- Completion distinguishes global, local, import, member, enum-pattern, struct-field, and keyword contexts and filters candidates by type, visibility, and position. Candidates include kind, detail, and required insertion text.
- Signature help at call positions returns parameters, active parameter, return type, and documentation.
- Incomplete source does not crash the server; hover and completion recover where semantic facts can still be established.
- The LSP does not reimplement name resolution, type inference, visibility, or ownership.
See LSP.
Acceptance Programs
Release qualification includes distributed-home scenarios, not only focused unit tests:
- 1. Grow
Vec<String>from empty, reserve multiple times, pop a string, and use it after vector drop. - Clear a
Vec<File>partway through and close any remainder at scope exit; every handle closes exactly once on failure paths as well. - Construct
Vec<Vec<String>>and verify both normal completion and recovery of inner values after failed growth. - Grow
Stringfrom empty repeatedly, verify its view, clear it, and reuse it. - Fix JSON-RPC diagnostics, hover, completion, and signature-help responses for a multi-file standard-library program.
Explicit Non-goals
The following are not v0.2.0 completion criteria, and temporary implementations that damage the foundation are not accepted:
- collection literals, map literals, and
...spread or variadic syntax - implicit allocator selection for string interpolation
- interface runtime dispatch and embedding
removeownership extraction from an arbitrary vector index and sparse live-element tracking- an implicit default allocator or multiple public allocator families
- a workspace-wide package index, rename, code actions, or formatting requests
- native backends other than
arm64-darwin
pop is included because it only shrinks the tail prefix. Arbitrary remove requires a separately designed sparse ownership state.
Work Order
The dependency order and completion state are:
- 1. Add fixed-array current-element staging to recursive drop obligations. (complete)
- Complete
Layout,RawBuffer, and Allocator allocate/grow/free contracts. (complete) - Implement initialized-prefix ownership and non-copy push/clear/drop for
Vec<T>. (complete) - Implement
Vec<T>.popas ownership transfer. (complete) - Move
Stringto the shared Allocator and fix growth-failure invariants. (complete) - Integrate hover with the stable typecheck-fact presentation model. (complete)
- Add context-aware completion and signature help to compiler analysis. (complete)
- Pass distributed-home acceptance and all verification with no unresolved required documentation. (complete)
Release Gate
Stable version and release metadata require all of:
./development/compiler/scripts/verify.shcargo fmt --manifest-path development/compiler/Cargo.toml --checkgit diff --check- build/run/LSP integration tests for the acceptance programs above
- no unresolved required v0.2.0 item in
development/docs/ordevelopment/TODO.md - a distribution generated by
package-local-release.shand reverified using only its.nocterhome
All gates passed for the v0.2.0 release commit.