Create docs/manual/stdlib/ with 12 topic pages covering all stdlib
modules (builtins, Option/Result, collections, iterators, math,
strings, ranges, async runtime, networking, time, synchronization).
Move scattered stdlib content from language manual pages into the
dedicated stdlib section, replacing with concise summaries and links.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Typechecker:
- Assignment operators (+=, -=, *=, /=, []=, etc.) must now return void.
Non-assignment operators still require a return type. This matches
Rust and Python semantics where compound assignment is a statement,
not an expression.
- Fix unspecializedGenericTemplate rejecting recursive generic types
like Option[DequeNode[T]] inside DequeNode[T]. Generic-kind bindings
from enclosing scope are now treated as concrete.
Codegen:
- ArrayIndexAssign and PointerIndexAssign magic builtins emit plain
assignments instead of comma expressions when return type is void.
- Fix anonymous ref symbol resolution for monomorphized types in
lowerIndirectBaseType (stale anon_ref -> named ref on the fly).
Stdlib:
- All compound assignment operators (+=, -=, *=, /=, string +=) and
all []= operators (array, seq, UncheckedArray, deque) now return void.
Tests:
- Updated operator definitions in c_codegen, codegen, and
monomorphization test preludes.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Stdlib:
- Add deque[T] backed by a ring buffer over Buffer[T] with O(1)
amortized push/pop at both ends, O(1) indexing, and proper
ownership transfer via move on pop
- Rename FIFOQueue to LIFOQueue (seq-backed, LIFO semantics)
- Add FIFOQueue backed by deque[T] for true FIFO with O(1) pop
- Refactor Buffer API: initBufferStorage -> init, bufferReserve ->
reserve with method-style calls
- Add async_queues.pn example with FIFO ordering, producer/consumer,
bounded back-pressure, and fan-in tests
Codegen fix:
- Fix anonymous ref type symbols being emitted for named ref types
when monomorphization creates new type objects with different IDs.
lowerIndirectBaseType now detects stale anonymous ref symbols and
resolves them to their named equivalents on the fly.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Parser:
- Fix parseGenericConstraint to recognize '=' as a stop token, enabling
fn foo(x: int64 = 0) syntax
- Fix parseModulePath and parseImportPath to handle '../' as a single
token (the lexer greedily merges '..' and '/')
Typechecker:
- Relax isCapable to accept fewer arguments when trailing parameters
have defaults
- Fill in default values for missing arguments in lowerResolvedCall
C runtime:
- Add peon_wait_queue_pop_back and peon_wait_queue_wake_last for O(1)
tail removal, making WaitQueue a proper deque
- Rename wake_one -> wake_first for symmetry with wake_last
Stdlib:
- Move sync.pn into sync/ directory (events.pn, queues.pn)
- Fix Event.set() missing self.signaled = true assignment (deadlock bug)
- Add wakeLast and isEmpty bindings for WaitQueue
- Fix WaitQueue clone to use UFCS init() style
Syntax highlighting:
- Fix import path regex to support multiple ../ prefixes
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Every compiled module .c file was getting an identical ~200-line preamble
with all type definitions, forward declarations, and function signatures
inlined. This extracts the preamble into a single peon_preamble.h that
each module #includes, reducing generated LOC by ~70% (13k -> 4k for
the sequences example).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace the outdated Section 10 with an accurate description of the
generational reference management model (not refcounting), the split
runtime source files, and the full async/networking/closure/trace
infrastructure. Update PeonGenerator struct to include inline frames
and trace support. Replace all __check_ref references with the actual
peon_open_ref/peon_check_ref/peon_deref naming.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Reflect the significant refactoring since the last doc updates:
architecture-review.md now annotates each finding with fix status
(magics.nim, parser semantic extraction, isInterfaceType helper,
format-string lowering move, codegen dedup, Iterable magic pragma).
architecture.md adds suspension normalization pass, tuple/void/value-enum
types, greedy operator lexing, pragma constructors, var/lent unification,
generic binary operators, and borrow-aware iterator interfaces.
manual.md replaces the old MutIterator/mnext protocol with the new
BorrowIterator/MutBorrowIterator hierarchy.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The monomorphizer had no handler for TypedBinaryExpr, so generic
user-defined operators like `..` were never specialized. Added a
genericArgs field to TypedBinaryExpr, stored the resolved generic
args during typechecking, and added a monomorphizer handler that
requests function specialization for generic binary operators.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The C backend previously tried to lower every binary operator as inline
C via a hardcoded operator table, which failed for user-defined operators
like `..` and `**`. Now TypedBinaryExpr carries the resolved operator
function from the typechecker, and the C backend emits a proper function
call for non-builtin operators while keeping inline C for builtins.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The lexer previously relied on a fixed symbol table to tokenize
operators, which meant user-defined operators like ** and .. could
not be lexed as single tokens. Now the lexer greedily consumes
contiguous runs of operator-class characters, with special handling
for . (Dot when alone, Symbol when part of a multi-char operator)
and a lookahead fix in parseNumber to avoid consuming . as a decimal
point when followed by another dot (e.g. 1..5).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>