Skip to content

format: let pointer collections carry a name - #412

Draft
gnidan wants to merge 3 commits into
format-virtual-regionsfrom
format-named-collections
Draft

gnidan wants to merge 3 commits into
format-virtual-regionsfrom
format-named-collections

Conversation

@gnidan

@gnidan gnidan commented Nov 11, 2026

Copy link
Copy Markdown
Member

Stacked on #411.

Today a pointer's result is a flat list of regions, so when two parts of a pointer use the same template, their regions have the same names and a consumer cannot tell them apart unless the producer renames every region with yields.

This lets any collection (group, list, conditional, scope, reference, templates) carry an optional name, an ethdebug/format/pointer/identifier. A collection's name scopes the regions inside it in the result of the pointer. A named list also scopes each element by its index, so the regions of one element stay together. Collection names affect only the result: ~read, .offset, .length and .slot see region names only, exactly as before, and yields renames regions only. A consumer that ignores collection names gets the same regions with the same names.

In the pointers package, each output region gets a path: the names of the named collections that contain it, outermost first, with the element index after each named list's name. For example, a list named items whose is is a group named elem gives ["items", 0, "elem"], ["items", 1, "elem"]. path is omitted when no named collection contains the region, so pointers without collection names give exactly the regions they gave before.

The new ethdebug/format/pointer example describes struct Line { Point a; Point b; } in storage with one point template referenced twice, distinguished only by the names of the two references. An integration test runs it against a real solc trace and reads each member's x and y by path.

Any collection may have a name. A collection's name scopes the regions
inside it in the result of the pointer, and a named list also scopes
each element by its index. Expressions do not see collection names.

The reference implementation gives each region a `path`: the names of
the named collections that contain it, outermost first, with the
element index after each named list's name.
@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.2

QR code for preview link

🚀 View preview at
https://ethdebug.github.io/format/pr-preview/pr-412/

Built to branch gh-pages at 2026-11-11 00:52 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

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.

2 participants