Skip to content

[Flow 2.0] Value semantics with compiler-inferred move defaults #696

Closed

Description

@godofecht

ROADMAP-SYNC: value-semantics-with-compiler-inferred-move-defaults

Part of epic #679.

Problem & Goal

Flow uses value semantics for structs. For larger buffers and complex resources, deep copying can incur performance penalties, while manual move semantics add syntax verbosity.
This issue tracks automated move inference where the compiler treats final uses of unique bindings as moves and applies copy-on-write or sharing when safety is established.

Deliverables

  • Analyze liveness to detect last uses of uniquely owned values.
  • Elide copies at codegen time by lowering last uses into moves.
  • Provide predictable performance characteristics without explicit move keywords.

Activity

  1. added
    enhancement
    on Aug 21, 2026
  2. added
    roadmap
    on Aug 21, 2026
  3. godofecht commented on Oct 1, 2026

    @godofecht
    ContributorAuthor

    Reference implementation against the retired Python compiler: tag archive/perf/696-move-inference (4626927). Useful as a design starting point for the Flow implementation.

  4. godofecht commented on Oct 7, 2026

    @godofecht
    ContributorAuthor

    Design decision, 2026-10-07, decided by the project owner (#1354): option 1. No move keyword, no copy-on-write or implicit sharing. Moves are inferred only at a proven last use of a uniquely owned function-scoped local or by-value parameter. Observable value semantics are unchanged; the move is a pure optimisation. #1354 merges after #1367. Recorded in docs/project/Questions.md by #1422.

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

    compilerenhancementroadmap

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions