# Arithmetic on integer type parameters

**URL:** https://discourse.julialang.org/t/arithmetic-on-integer-type-parameters/12401
**Category:** New to Julia
**Created:** [July 15, 2018, 11:10pm UTC](https://discourse.julialang.org/t/arithmetic-on-integer-type-parameters/12401 "2018-07-15T23:10:57Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![retrosnub](https://avatars.discourse-cdn.com/v4/letter/r/ecb155/32.png) [@retrosnub](https://discourse.julialang.org/u/retrosnub)
#### Post date: [July 15, 2018, 11:10pm UTC](https://discourse.julialang.org/t/arithmetic-on-integer-type-parameters/12401/1 "2018-07-15T23:10:57Z")

</div>

I’m trying to do something along the likes of

```julia
struct Simplex{d}
  vindices::NTuple{d+1,Int}
end

```

I know of the workaround in [this answer](https://stackoverflow.com/questions/34073243/expressions-depending-on-integer-type-parameters-in-type-definitions-in-julia-ar) but is there some other solution that doesn’t involve changing my type signature?  
If not, would this be a reasonable feature request? By declaring `d<:Int` I feel like the compiler shouldn’t have a problem figuring out simple arithmetic.

---

<div class="post-metadata">

### Author: ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)
#### Post date: [July 16, 2018, 12:58am UTC](https://discourse.julialang.org/t/arithmetic-on-integer-type-parameters/12401/2 "2018-07-16T00:58:18Z")

</div>

> [@retrosnub](#):
>
> d\<:Int

No, it’s sort of `d::Int` but certainly not `d<:Int`.

> [@retrosnub](#):
>
> is there some other solution that doesn’t involve changing my type signature?

No.

> [@retrosnub](#):
>
> would this be a reasonable feature request

Not directly but kind of. This is [Proposal: Defer calculation of field types until type parameters are known · Issue #18466 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/18466)

---

<div class="post-metadata">

### Author: ![retrosnub](https://avatars.discourse-cdn.com/v4/letter/r/ecb155/32.png) [@retrosnub](https://discourse.julialang.org/u/retrosnub)
#### Post date: [July 16, 2018, 4:52pm UTC](https://discourse.julialang.org/t/arithmetic-on-integer-type-parameters/12401/3 "2018-07-16T16:52:05Z")

</div>

Yes `d::Int` of course. Thanks for pointing me to the ticket.  
There I found the solution (at least for my specific usecase):

```julia
struct Simplex{d}
  vindices::Tuple{Int,Vararg{Int,d}}
end

```
