Skip to content

Add typed language foundations for 0.1.0-rc.3 - #15

Merged
kleeedolinux merged 18 commits into
poplanguage:masterfrom
kleeedolinux:master
Jul 13, 2026
Merged

Add typed language foundations for 0.1.0-rc.3#15
kleeedolinux merged 18 commits into
poplanguage:masterfrom
kleeedolinux:master

Conversation

@kleeedolinux

Copy link
Copy Markdown
Collaborator

Summary

Expand the statically typed Pop Lang foundation for 0.1.0-rc.3 and add the
roadmap toward the first supported 0.1.0 release.

This change adds:

  • typed string concatenation, escapes, interpolation, and conversion;
  • decimal floats, complete numeric ordering, casts, and checked conversions;
  • numeric for ranges, break, and continue;
  • conditional expressions and elseif;
  • typed compound assignment with single-evaluation targets;
  • fixed type packs, tuple projection, destructuring, and multiple returns;
  • typed table lookup, insertion, replacement, and deterministic growth;
  • runtime constants, erased type aliases, and nominal scalar enums;
  • explicit callable generics, generic records, and generic tagged unions;
  • deterministic specialization of reachable generic functions and data in MIR;
  • MIR-interpreter and LLVM execution coverage for the new language features;
  • fail-closed C-backend rejection where runtime capabilities are unsupported;
  • ROADMAP.md covering the remaining 0.1.0 release blockers;
  • release-workflow restrictions for the upstream repository.

Optional narrowing, generalized iteration, the complete typed-error workflow,
and the remaining production runtime/tooling work are intentionally tracked in
the roadmap rather than presented as completed.

Architecture traceability

  • Authorizing architecture section or ADR:
    • ADR 0040: decimal float literals and numeric conversions
    • ADR 0041: typed string composition and formatting
    • ADR 0042: numeric ranges and loop control
    • ADR 0043: conditional expressions
    • ADR 0044: compound assignment
    • ADR 0045: fixed type packs and multiple assignment
    • ADR 0046: typed table access and mutation
    • ADR 0047: evaluated runtime constants
    • ADR 0048: erased type aliases
    • ADR 0049: nominal scalar enums
    • ADR 0050: executable generic specialization
    • architecture/04-intermediate-representations.md
    • architecture/07-implementation-roadmap.md
    • architecture/08.1-closed-design-questions.md
    • architecture/12-type-system-architecture.md
    • architecture/13-syntax-and-nomenclature.md
    • architecture/19-architecture-conformance-and-regression-policy.md
  • New or changed public contract:
    • Adds the typed source constructs listed above.
    • Generic calls require explicit type arguments in the bootstrap subset.
    • Generic records use expected-type construction.
    • Reachable generic functions, records, and unions are fully specialized into
      concrete backend-neutral MIR.
    • Arrays remain fixed-length; typed tables may grow deterministically.
    • The experimental C backend remains capability-limited and fail-closed.
    • ROADMAP.md identifies 0.1.0-rc.3 as the current release candidate and
      records the accepted path to 0.1.0.
  • Architecture documents, examples, or terminology updated:
    • Updated the IR, type-system, syntax, closed-question, open-question, and
      implementation-roadmap documents.
    • Added ADRs and canonical Luau-shaped examples for the implemented behavior.
    • Preserved Item → Module → Bubble → Package → Workspace terminology.

Verification

  • Tests were added or updated before implementation where behavior changed.
  • Positive behavior is covered.
  • Negative/rejection boundaries are covered.
  • Convention, consistency, and regression coverage is present where relevant.
  • Cross-backend or differential coverage is present where relevant.
  • cargo fmt --all -- --check
  • cargo check --workspace --all-targets
  • cargo test --workspace --all-targets
  • cargo clippy --workspace --all-targets -- -D warnings

If a check was not run, explain why:

  • Formatting, workspace checking, and the complete workspace test suite passed
    for the generic implementation before the final compile-time generic test was
    added.
  • The current focused test
    explicit_generic_compile_time_calls_use_concrete_static_types fails because
    the compile-time evaluator publishes no constant for the generic call. This
    remains a blocker before merge.
  • Focused MIR, driver, interpreter, LLVM, C-backend, and architecture tests
    passed.
  • All ROADMAP.md links resolve and git diff --check passed.
  • Clippy is blocked by existing warnings in the runtime collector and syntax
    crates, including too_many_lines and Option<Option<T>> warnings.

Review notes

  • No dynamic typing, runtime string lookup, broad reflection, or universal-table behavior was introduced.
  • HIR/MIR remain backend-neutral.
  • No generated artifacts, dependency caches, credentials, or editor files are included.
  • This is ready for technical review.

Known limitations and follow-up work:

  • Fix the failing explicit generic compile-time constant test before merge.
  • The bootstrap generic subset requires explicit type arguments and uses full
    specialization. Type-argument inference, portable generic reference metadata,
    and typed code sharing remain later work.
  • The C11 backend remains experimental and rejects unsupported managed/runtime
    behavior instead of providing a fallback.
  • Optional narrowing, generalized iteration, typed errors, production GC,
    standard-library completion, Package/Workspace tooling, and final release
    gates are tracked in ROADMAP.md.
  • popbook/ is local untracked content and is not included in this pull request.

Add decimal and exponent literals, complete numeric ordering, and explicit target-type conversions under ADR 0040. Carry exact conversion kinds through compile-time IR, HIR, and MIR so verification and optimization retain one portable contract.\n\nImplement checked conversion behavior in the MIR interpreter, LLVM, and strict C11 backends, including NumericConversion traps and direct IEEE rounding without double-rounding through Float64.
Define Luau-shaped concatenation, interpolation, and escape decoding as a closed static contract. Lower primitive formatting through backend-neutral HIR and MIR operations so the interpreter and native backend produce identical UTF-8 values without reflection or dynamic dispatch.\n\nAdvance the native runtime ABI for allocating string helpers and keep constant string composition available to the runtime-free C subset.
Define the first numeric for form as an inclusive, fixed-integer range with once-only bound evaluation and an immutable loop binding. Add typed break and continue semantics for while, repeat, and numeric for loops without introducing dynamic iteration.\n\nPreserve the source concepts in HIR and lower them to verified MIR control flow with checked progression, typed zero-step traps, block arguments, and mandatory backedge safe points. Keep generalized iteration deferred to the nominal Iterable and Iterator contracts.
Define the lazy, statically typed conditional-value contract in ADR 0043 and synchronize the language architecture. Parse and type-check Luau-shaped if expressions and elseif chains, preserve them in HIR, and lower them through typed MIR control-flow joins shared by compile-time evaluation and native backends.\n\nMark joins unreachable when every statement arm terminates so nested elseif chains cannot expose undefined live-state values during LLVM edge splitting.
Define compound assignment as a closed typed extension of Pop Lang's existing numeric and string operators. Preserve mutable field and array targets through HIR so receivers and indexes evaluate once, then lower them to existing checked MIR load, operation, barrier, and store instructions.\n\nReject immutable and mismatched targets, trap on indexed bounds before evaluating the right-hand side, and keep captured local mutation on shared cells across interpreter and native backends.
Define exact fixed-pack returns and comma-shaped local bindings without Lua value adjustment or a dynamic variadic carrier. Preserve target, value, and store ordering through verified HIR and MIR tuple projection so interpreter and LLVM behavior agree.\n\nReject the managed representation explicitly in the runtime-free C subset and support deterministic fixed-pack bindings in restricted compile-time evaluation.
Permit one-based literal projection from fixed tuples while preserving the exact element type. Reject computed and invalid indexes during type checking, carry the operation through verified HIR, and reuse the canonical MIR tuple projection across compile-time evaluation, the interpreter, and LLVM.
Define optional typed lookup and insert-or-replace assignment for associative tables. Carry closed table operations through verified HIR and MIR, preserve deterministic insertion order, and add precise native growth behind ABI 1.6 while keeping fixed arrays unchanged.
Substitute deterministically evaluated namespace constants into typed runtime bodies. Preserve exact types and visibility while avoiding mutable globals, runtime name lookup, and backend-specific constant machinery.
Resolve non-generic namespace aliases to their exact target types before HIR construction. Support alias chains while rejecting cycles and type arguments without introducing nominal identity or backend operations.
Introduce payload-free enum declarations with stable typed case identities and exact same-enum equality. Preserve enum declarations and constants through verified HIR and MIR, execute them in the interpreter, and lower their compact discriminants to LLVM i32 values.
Retain ordered semantic type arguments in HIR and fully specialize reachable concrete function and data instances during MIR lowering. This makes generic functions, records, and tagged unions executable without runtime type lookup or dynamic values.
@kleeedolinux
kleeedolinux merged commit aaef13b into poplanguage:master Jul 13, 2026
1 check failed
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