Skip to content

Add runtime string construction and concatenation #81

Description

@itsfuad

Goal

Add runtime construction and concatenation for owned str values.

Parent

Follow-up to #29. Existing literals, borrowed views, ranges, and compiler operations remain canonical.

Required semantics

  • Construct immutable owned str values from runtime data.
  • Define concatenation result ownership and allocator provenance.
  • Preserve UTF-8 validity and byte-length semantics.
  • Reuse existing owned string carrier and allocator descriptor.
  • Keep construction separate from C and FFI boundary conversion tracked by the sibling follow-up.

Constraints

  • No mutable string contents.
  • No hidden process allocator when an input owner carries allocator provenance.
  • No alternate string carrier or backend-only shortcut.
  • Source operations must lower through canonical semantic, HIR, MIR, and LLVM evidence.

Validation

  • Typechecker and ownership tests for construction and concatenation.
  • HIR, MIR, and LLVM tests for allocator and cleanup behavior.
  • Positive runtime fixtures for empty, ASCII, UTF-8, chained, and temporary values.
  • Negative fixtures for invalid ownership or unsupported operand forms.
  • 32-bit and 64-bit carrier checks.

Activity

  1. added
    enhancementNew feature or request
    runtime-loweringHIR/MIR/backend runtime lowering work
    language-modelPeeper language model, ownership, pointer, optional, array/slice work
    on Aug 21, 2026
  2. moved this from Todo to In Progress in Peeper Roadmapon Aug 29, 2026
  3. itsfuad commented on Aug 29, 2026

    @itsfuad
    MemberAuthor

    Implementation complete and merged into local main.

    Local commits:

    • 0f8b98b Add runtime string construction and concatenation
    • 458bd1a Merge runtime string construction and concatenation

    Delivered:

    • from_bytes(&[..]byte[, Allocator]) -> str with UTF-8 validation, exact allocation, and empty no-allocation path
    • str + &str -> str with consumed left owner, borrowed right operand, checked length addition, and allocator provenance preservation
    • explicit semantic evidence plus HIR/MIR/LLVM nodes
    • positive runtime, invalid UTF-8, rejected-form, move, pipeline, and 386/amd64 LLVM coverage
    • language specification, allocator provenance, and TODO updates

    Validation passed:

    • GOCACHE=/tmp/peeper-go-cache CCACHE_DISABLE=1 go test ./...
    • GOCACHE=/tmp/peeper-go-cache CCACHE_DISABLE=1 ./scripts/build.sh
    • PEEPER_BIN="$PWD/build/bin/peeper" GOCACHE=/tmp/peeper-go-cache CCACHE_DISABLE=1 go test -count=1 ./x_test
    • clang validation for linux/386 and linux/amd64 generated LLVM

    Remote main has not been pushed yet. Issue and roadmap item remain In Progress until published.

  4. itsfuad commented on Aug 29, 2026

    @itsfuad
    MemberAuthor

    Published on main in merge commit 458bd1a. Full compiler, bundled fixture, and 386/amd64 LLVM validation passed. Closing as completed; C/FFI conversion remains tracked separately in #82.

  5. moved this from In Progress to Done in Peeper Roadmapon Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestlanguage-modelPeeper language model, ownership, pointer, optional, array/slice workruntime-loweringHIR/MIR/backend runtime lowering work

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions