Skip to content

Implement DEL object, reference, dispatch, recursion, and closure runtime lowering #31

Description

@Teakowa

Parent: #8

Goal

Lower the advanced DEL/OSTW runtime semantics already represented in typed DEL HIR into canonical Workshop programs, choosing concrete runtime encodings only where observable semantics and Workshop constraints require them.

Context

#6 deliberately kept allocation, deletion, references, virtual dispatch, recursion, lambdas, and storage intent backend-neutral. Once #30 establishes the core HIR -> WIR path, this issue provides the target-specific runtime strategies needed for the advanced declared DEL/OSTW surface.

Upstream OSTW layouts are compatibility evidence, not an architecture mandate. Exact helper variables, temporary names, dispatch tables, storage layout, and optimizer shape are not correctness requirements unless they affect observable behavior or Workshop limits.

Scope

  • Define and implement concrete storage strategies for DEL locals/parameters/member/static-member intent that must survive into Workshop execution.
  • Implement class/object allocation and deallocation semantics, including object identity and evidence-backed reuse behavior.
  • Implement reference validity/lifetime semantics, including stale-reference/generation validation where required by the declared compatibility contract.
  • Implement instance fields, static fields, inheritance, overrides, and virtual dispatch.
  • Implement struct lowering for the declared value/parallel/single semantics without leaking Workshop storage choices back into typed DEL HIR.
  • Implement enum runtime representation and pattern-binding behavior required by the declared corpus.
  • Implement extended-collection storage where its observable semantics require backend support.
  • Implement recursion runtime support for declared recursive calls/subroutines.
  • Implement lambda/function-value invocation and capture behavior, including by-value capture semantics already established by the frontend contract and any evidence-backed by-reference behavior.
  • Preserve source provenance through generated helper structures sufficiently for diagnostics and compatibility evidence.
  • Add end-to-end positive/negative tests for runtime-sensitive behavior, especially allocation/delete/reuse, invalid references, inheritance/dispatch, recursion, and closure capture.
  • Track Workshop cost/limit implications where a lowering choice could materially affect validity or stability; optimize only where required by correctness, declared limits, or evidence.

Non-goals

  • Reproducing upstream temporary-variable names, helper-rule naming, exact array layouts, optimizer passes, or emitted formatting for their own sake.
  • Moving high-level DEL semantics into workshop-rs.
  • Redesigning typed DEL HIR merely to match one chosen runtime encoding unless integration evidence proves the existing intent model insufficient.
  • Workshop -> DEL reconstruction.

Acceptance criteria

  • Runtime-sensitive DEL corpus cases lower into canonical WIR and emit valid Workshop through workshop-rs.
  • Allocation/deletion and stale-reference cases preserve the declared observable semantics under reuse scenarios.
  • Inheritance and virtual dispatch select the compatible method implementation across representative class hierarchies.
  • Recursive functions/subroutines and lambda captures have end-to-end evidence rather than only HIR/oracle evidence.
  • Runtime encodings remain encapsulated in the lowering layer; parser/semantic/HIR contracts stay backend-neutral unless an evidence-backed contract change is required.
  • Remaining runtime gaps are explicit structured failures and support-matrix states are advanced only with corresponding tests.

Dependencies

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions