Add `usize` to DSL
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 283
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 135
Description
Right now in the DSL we don't have `usize` -- seems like it's getting to the point we should add it. I did a factoring we wanted to do for a while, to uniformly use `InterpValues` in `ConcreteTypeDims` (previously there was also a "raw" int64_t integral variant). We used to _only_ support parametric values being integers, but now we've made them more arbitrary DSL values (`InterpValue`s).
Even though a parametric value can be arbitrary, the values that turn into array dimensions you still want to be unsigned and common-width; for example:
```
fn p() -> bits[N] {
bits[N]:0
}
```
note that `N` there is a `u8`, not a `u32` (or `usize`, because that doesn't exist yet), but it ends up being used to construct a `bits[N]`.
Now consider:
```
fn q() -> bits[N] {
bits[N]:0
}
```
Then a question is, is decltype(q()) type-equivalent to decltype(p())?
Today's answer is no, because the dimension N in bits[N] has a different bitwidth, so they are not type equivalent. So you'll get a type error, and it will be confusing. But if we only let usize values flow to array dimension "slots" in the type system everything would be the same and we wouldn't need to worry about that particular non-equivalence problem.
Contributor guide
Assessment
This issue has not been assessed yet.