Repository navigation
Conversation
gnidan
added a commit
that referenced
this pull request
Nov 10, 2026
Contributor
|
gnidan
added a commit
that referenced
this pull request
Nov 10, 2026
gnidan
force-pushed
the
format-define-order
branch
from
November 10, 2026 06:09
de6be9b to
8c2b29a
Compare
A member sees the other members of the same define by name, and its own name means the variable of the enclosing scope. Members are queued and retried, as region fields are for ~this; a cycle throws.
JSON objects are unordered, so the members of a define may use each other in any order. Reorder the long string example's define so the integration test resolves a member before the one it uses.
gnidan
force-pushed
the
format-define-order
branch
from
November 10, 2026 08:24
8c2b29a to
b90abe5
Compare
This was referenced Nov 10, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #401. Stacked on #404.
The scope schema said
definevariables are evaluated in order, so later ones may use earlier ones. JSON objects are unordered, so tools that sort keys broke such pointers. This change makes member order irrelevant:definemeans that member.{slot: {~sum: [slot, 1]}}still means the outerslotplus 1).A consumer evaluates each member after the members it uses; a cycle makes the pointer invalid.
@ethdebug/pointersfollows the precedent of region fields that refer to each other through~this:processScopequeues the members and retries one that uses a member not evaluated yet, and throws "Circular reference detected" when every remaining member has failed since the last success. Each member sees its siblings through a view of the outer variables, so a sibling name never falls back to the outer variable before that sibling is evaluated.The long
string storageexample in ethdebug/format/pointer now liststotal-slotsbefore thestring-lengthit uses, so the pointers integration test resolves an out-of-orderdefineon a real trace. The scope schema gains a small example of both an out-of-order member and a member's own name meaning the outer variable, and the web docs no longer say JSON objects are ordered.