Relaxed lexical scoping
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 126
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
This RFC proposes loosening the scoping rules in SUS so that variables may be referenced even before they are declared, as long as they are in the same scope. The idea is that, for hardware, there is no happens-before relation for signal validity. By relaxing lexical scoping, we can make mutually dependent hardware descriptions more natural to write.
Generative code is affected by this change as well, but the impact there is different. Generative constructs still need to respect sequential ordering, so through the use of warnings (or even errors) we can continue to enforce strict sequencing where it matters.
Some restrictions remain: variables declared inside a nested scope, such as within an if block, remain inaccessible from the outside. What changes is that within a single scope, variables may be used before they appear in the source, and shadowing is disallowed to avoid ambiguity.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the RFC's proposed changes to same-scope references, sequential ordering, nested scopes, and shadowing. Then locate the compiler's scope and declaration-order handling; done means the behavior is specified consistently for hardware and generative constructs, with the remaining restrictions and warning or error rules resolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers, embedded-iot
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100