Skip to content

Expose cross-source HAMT map and set clones - #480

Draft
helly25 wants to merge 1 commit into
implement/hamt-owned-clonefrom
implement/hamt-key-extractors
Draft

helly25 wants to merge 1 commit into
implement/hamt-owned-clonefrom
implement/hamt-key-extractors

Conversation

@helly25

@helly25 helly25 commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Flat HAMT maps and sets now expose explicit cross-source cloning, letting callers move a complete persistent value into the allocation domain whose guarantees they need. Ordinary copies remain cheap shared snapshots; changing domains is visible, fallible, and deep.

AG;DR

  • adds source-independent identity and pair-key extractors shared by map and set cores;
  • exposes try_clone_to<OtherSource>(...) on persistent flat maps and sets;
  • exposes consuming transient clone overloads that return persistent destination containers;
  • preserves hash/equality state, keys, mapped values, and source snapshots for const-lvalue cloning;
  • consumes an rvalue source only after a successful deep clone and preserves it after failure;
  • makes destination source type and constructor arguments explicit, including bounded inline sources;
  • documents ownership of source objects versus external buffers or PMR resources borrowed by them;
  • validates public destination types, independent addresses, successful source reuse, transient cloning, and bounded failure;
  • validated locally with the focused key-extractor, flat-map, and flat-set tests; the complete GCC/Clang/sanitizer/coverage matrix will run in this PR's own context.

This is a draft stacked on the owned-domain clone layer in #479. It must remain unmerged until the implementation stack is reviewed and merge-ready as a whole.

@helly25
helly25 force-pushed the implement/hamt-key-extractors branch from 9053e20 to 4683af1 Compare September 16, 2026 11:05

This branch has not been deployed

No deployments
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