Skip to content

Commit f3a60ee

Browse files
committed
format: say that a scope's variables are visible only within its in
1 parent 67c4538 commit f3a60ee

3 files changed

Lines changed: 23 additions & 1 deletion

File tree

‎CHANGELOG.md‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,19 @@ The sections do not signal obligations; the prefixes do.
5353

5454
## Unreleased
5555

56+
### Changed
57+
58+
- The variables of a scope (`define`/`in`) are visible only within its `in`.
59+
Pointers outside the scope, such as later members of an enclosing group, do
60+
not see them, and a variable defined with an outer variable's identifier
61+
shadows it only within `in`. The description now says so ([#318]).
62+
- Schemas: **ethdebug/format/pointer/collection/scope**
63+
- Producers: no change needed. The text states the existing meaning; solc's
64+
storage templates already depend on it.
65+
- Consumers: required: a consumer that keeps a scope's variables after its
66+
`in` must discard them there. `@ethdebug/pointers` does so from
67+
[#317].
68+
5669
## 0.1.0-draft.1 — 2026-10-03
5770

5871
### Added
@@ -660,3 +673,5 @@ First published version of the specification.
660673
[#303]: https://github.com/ethdebug/format/pull/303
661674
[#305]: https://github.com/ethdebug/format/pull/305
662675
[#309]: https://github.com/ethdebug/format/pull/309
676+
[#317]: https://github.com/ethdebug/format/pull/317
677+
[#318]: https://github.com/ethdebug/format/pull/318

‎packages/web/docs/core-schemas/pointers/collections.mdx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ evaluates to a non-zero value.
8585
## Scope
8686

8787
A **scope** defines variables that can be used in a nested pointer. Variables
88-
are evaluated in order, so later variables can reference earlier ones.
88+
are evaluated in order, so later variables can reference earlier ones. They are
89+
visible only within `in`: pointers outside the scope, such as later members of
90+
an enclosing group, do not see them.
8991

9092
Scopes help break complex pointer definitions into readable steps. For examples
9193
combining scopes with keccak256 for storage slot computation, see the

‎schemas/pointer/collection/scope.schema.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ description: |
1010
expression by identifier. Variables are specified **in order**, so that
1111
later appearing variables may reference earlier ones in the same object.
1212
13+
The variables are visible only within `in`. Pointers outside this scope
14+
do not see them: later members of an enclosing group, for example, see
15+
only the variables of their own enclosing scopes. A variable defined here
16+
with the same identifier as an outer variable shadows it within `in`.
17+
1318
type: object
1419

1520
properties:

0 commit comments

Comments
 (0)