Simplify using struct parametric to change function interfaces and support typedefs.
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 283
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 135
Description
Currently in order to parameterize the function interface using struct parametrics, something like the following needs to be written:
```
struct Params {
bit_width : u32,
num_elements : u32,
}
pub fn StridedArrayUpdate(
array_in : bits[W][N],
index : u32,
stride : u8,
val : bits[W]) -> bits[W][N] {
...
}
```
This issue is to simplify the usage to something similar to
```
struct Params {
bit_width : u32,
num_elements : u32,
}
pub fn StridedArrayUpdate(
array_in : bits[params.bit_width][params.num_elements],
index : u32,
stride : u8,
val : bits[params.bit_width]) -> bits[params.bit_width][params.num_elements] {
...
}
```
Even simpler would be to support typedefs
```
struct Params {
bit_width : u32,
num_elements : u32,
type ElementType = bits[bit_width],
type ArrayType = ElementType[num_elements],
}
pub fn StridedArrayUpdate(
array_in : params.ArrayType,
index : u32,
stride : u8,
val : params.ElementType) -> params.ArrayType {
...
}
```
Contributor guide
Assessment
This issue has not been assessed yet.