Skip to content

Add universal to-string conversion builtins (#106)#196

Merged
aallan merged 1 commit into
mainfrom
feature/106-to-string-builtins
Mar 4, 2026
Merged

Add universal to-string conversion builtins (#106)#196
aallan merged 1 commit into
mainfrom
feature/106-to-string-builtins

Conversation

@aallan

@aallan aallan commented Mar 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • Added 5 new string conversion builtins for all primitive types: bool_to_string(Bool -> String), nat_to_string(Nat -> String), byte_to_string(Byte -> String), float_to_string(Float64 -> String), and int_to_string(Int -> String) (alias for existing to_string)
  • ADT/compound type Show deferred to abilities (Abilities and type constraints #60)
  • Moved Incremental compilation #56 (incremental compilation) from C8e to C8.5 in the roadmap

Implementation details

  • bool_to_string: Zero allocation — uses interned "true"/"false" from StringPool
  • byte_to_string: 1-byte heap allocation, stores byte value as single character
  • float_to_string: 32-byte buffer, integer + fractional digit extraction, trailing zero trimming (keeps at least 1 decimal digit)
  • nat_to_string and int_to_string: Reuse existing _translate_to_string implementation

Files changed (14)

  • vera/environment.py — 5 new FunctionInfo entries
  • vera/wasm/calls.py — Dispatch + 3 new translate methods
  • vera/wasm/inference.py — WASM + Vera return type inference
  • vera/codegen/modules.py — Cross-module call resolution
  • tests/test_codegen.py — 12 new tests (5 classes)
  • tests/test_checker.py — 10 new type checker tests
  • examples/string_ops.vera — New conversion demos
  • spec/04-expressions.md, SKILL.md, vera/README.md — Doc updates
  • README.md — Strikethrough Add universal to-string conversion (Show/Display) for all types #106, move Incremental compilation #56 to C8.5
  • CHANGELOG.md, vera/__init__.py, pyproject.toml — v0.0.64

Test plan

  • 1402 tests pass (pytest tests/ -q)
  • mypy clean (mypy vera/)
  • All 15 examples pass (python scripts/check_examples.py)
  • Version sync verified (python scripts/check_version_sync.py)

Closes #106

Add 5 new string conversion builtins for all primitive types:
bool_to_string, nat_to_string, byte_to_string, float_to_string,
and int_to_string (alias for existing to_string). ADT/compound
type Show deferred to abilities (#60).

Also moves #56 (incremental compilation) from C8e to C8.5.

Co-Authored-By: Claude <noreply@anthropic.invalid>
@aallan aallan merged commit 0f9f9d9 into main Mar 4, 2026
10 checks passed
@aallan aallan deleted the feature/106-to-string-builtins branch March 4, 2026 16:49
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.

Add universal to-string conversion (Show/Display) for all types

1 participant