Skip to content

[core][doc] Update documents for release + Parser fixes + faster compiles - #60

Merged
forfudan merged 3 commits into
mainfrom
dev
Aug 12, 2026
Merged

[core][doc] Update documents for release + Parser fixes + faster compiles#60
forfudan merged 3 commits into
mainfrom
dev

Conversation

@forfudan

@forfudan forfudan commented Aug 12, 2026

Copy link
Copy Markdown
Owner

This PR update documents for release and fix several issues.

The main reason to upgrade is an FFI signature clash in _read_password_asterisk(). Our read(2) binding passed its buffer as Int(ptr), declaring read as (Int, Int, Int) -> Int while the standard library declares the same symbol with a pointer. Any module linking both failed to lower to LLVM IR, so this could break the build of a project that merely depends on ArgMojo. The buffer is passed as a real pointer now.

Twelve parser bugs are fixed. Several of them share one root cause: has() is true for an argument that only carries a .default(), and four group constraints plus implies() were using it to mean "the user typed this". They ask the new was_provided() now. The rest are independent: defaults were all written to the string store, so a .flag().default()
was invisible to get_flag(); an argument with both .prompt() and .default() was never prompted; an option could swallow the next option as its value; a required positional could be satisfied by a later positional's default; persistent-argument conflicts were caught in only one registration order; non-ASCII passwords came back corrupted; and
--=hello set the first positional instead of being rejected. Bad defaults are now caught at registration rather than reaching the user.

New API: was_provided() and get_float() on ParseResult, working Float64 options and positionals, Int() unwrapping for Count, and a consistent parameter set across the four declarative wrappers, so a positional no longer has to drop to the builder API for prompt, password, hidden, deprecated or ranges.

Compiling a program that uses ArgMojo is about 20% faster. Most of it is examples/build.sh linking the prebuilt package instead of recompiling the sources into all eight binaries; the rest is argument lookup returning an index instead of deep-copying the Argument on every option token, String(...) in place of long + chains, and byte comparisons in _looks_like_number() and _levenshtein(). Help text, completion scripts and error messages are byte-for-byte identical before and after.

CI also runs tests/test_dispatch.mojo now. It was in the local test task but in none of the workflow jobs, so the auto-dispatch tests added in v0.6.0 had never run on a pull request.

733 tests across 13 modules pass, along with the negative schema checks and all eight examples.

@forfudan
forfudan merged commit 2ba77c1 into main Aug 12, 2026
5 checks passed
@forfudan
forfudan deleted the dev branch August 12, 2026 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant