Should structs use existing module generative code system?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 126
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
So I've been looking to add structs to SUS. But I'm not entirely convinced by my current approach.
Basically, I had the idea of integrating struct declarations with the existing SUS generative code system, but instead of
A regular struct looks pretty unassuming:
struct MyVec3 {
int x
int y
int z
}
And having the generative code would allow for templated structs like
struct MyVec<T> {
input gen int SIZE
T[SIZE] arr
}
And even structs with optional fields like
struct BRAMRead<T> {
input gen bool ECC_INCLUDED
T read_data
if ECC_INCLUDED { // (compiletime)
bool ecc_did_error
}
}
The idea here is that any non-gen (compiletime) declaration is interpreted as a struct field, whereas gen declarations (like the template parameters), are executable compile-time code.
While this is easy to implement, and even gains a little bonus for language consistency, I can't help but fear I might be shooting myself in the foot somehow.
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
No files or tests are named. Start by reading the existing SUS generative code system and its handling of compile-time declarations, then assess how regular, templated, and conditionally shaped structs should interact with it. Done means a decided design with documented semantics and an agreed implementation scope.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100