Skip to content

Conversation

@jnthntatum
Copy link
Collaborator

Add clarification on comprehension scoping and conformance tests.

I think this is implied but not spelled out anywhere. The Go / Java / C++ checker implementations don't handle this well when there's a collision with a qualified name in the root scope.

Add clarification on comprehension scoping and conformance tests.
@jnthntatum jnthntatum requested a review from l46kok January 6, 2026 23:43
doc/langdef.md Outdated
comprehension. If there is a match, that interpretation is chosen. If not,
the name is resolved against parent scopes until a match is found or the global
scope is searched. For example, in `[1].exists(x, x == 1)`, the interpretation
that `x` is the iterator variable is chosen over any alternative.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rephrase as:

For example, in `[1].exists(x, x == 1)` the iteration variable `x` is a local variable which shadows any identifier with the same simple name in ancestor scopes.

I'm still not sure if that's quite right, but I think we should phrase this as "scoping" and "shadowing".

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. Wdyt?

@jnthntatum jnthntatum force-pushed the resolution_clarfication branch from 4ede9ef to 1989870 Compare January 7, 2026 01:31
@jnthntatum jnthntatum force-pushed the resolution_clarfication branch from 1989870 to b8b1290 Compare January 7, 2026 03:34
@jnthntatum jnthntatum requested review from jcking and l46kok January 7, 2026 20:46
@jnthntatum jnthntatum force-pushed the resolution_clarfication branch from f0348fe to 6006184 Compare January 8, 2026 23:54
@jnthntatum jnthntatum force-pushed the resolution_clarfication branch from 6006184 to 6bb648c Compare January 8, 2026 23:56
@jnthntatum jnthntatum merged commit 8d28382 into google:master Jan 12, 2026
3 checks passed
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.

5 participants