Skip to content

Allow inter-scope shadowing#1561

Merged
dneto0 merged 2 commits intogpuweb:mainfrom
alan-baker:shadowing
Mar 29, 2021
Merged

Allow inter-scope shadowing#1561
dneto0 merged 2 commits intogpuweb:mainfrom
alan-baker:shadowing

Conversation

@alan-baker
Copy link
Copy Markdown
Contributor

Fixes #1556

  • Allows identifiers to be reused so long as the end of the scope is
    different
    • practically, this works very much like c-style scoping
    • one difference is that a function parameter can shadow its
      function's name
    • covers resolution when multiple declarations are in scope
  • add examples
  • function names no longer must be unique
  • clarify scope of function parameters
  • remove a duplicated note

Fixes gpuweb#1556

* Allows identifiers to be reused so long as the end of the scope is
  different
  * practically, this works very much like c-style scoping
  * one difference is that a function parameter can shadow its
    function's name
* add examples
* function names no longer must be unique
* clarify scope of function parameters
* remove a duplicated note
@github-actions
Copy link
Copy Markdown
Contributor

Previews, as seen at the time of posting this comment:
WebGPU | IDL
WGSL
b9fa86e

Copy link
Copy Markdown
Contributor

@kvark kvark left a comment

Choose a reason for hiding this comment

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

I thought we are going to stop on allowing the locals to shadow globals.
But this goes way further.

@alan-baker alan-baker added the wgsl WebGPU Shading Language Issues label Mar 25, 2021
@alan-baker
Copy link
Copy Markdown
Contributor Author

I thought we had consensus on this level, but not intra-scope shadowing. In any event, we can modify this if necessary.

Copy link
Copy Markdown
Contributor

@dneto0 dneto0 left a comment

Choose a reason for hiding this comment

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

This is really tidy.
Some typos, and a minor fix is required.

* Fix typos
* Update scope to potentially denote associated objects
* Clarify name resolution
  * add a new definition for resolves
* remove bad link
@github-actions
Copy link
Copy Markdown
Contributor

Previews, as seen at the time of posting this comment:
WebGPU | IDL
WGSL
96ae0c7

Copy link
Copy Markdown
Contributor

@dneto0 dneto0 left a comment

Choose a reason for hiding this comment

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

Thanks!

@dneto0 dneto0 merged commit 083bf89 into gpuweb:main Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wgsl WebGPU Shading Language Issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wgsl: support inter-scope shadowing

3 participants