# Are type constraints in certain method definitions in LinearAlgebra necessary?

**URL:** <https://discourse.julialang.org/t/are-type-constraints-in-certain-method-definitions-in-linearalgebra-necessary/42670>\
**Category:** General Usage\
**Tags:** question\
**Created:** [July 7, 2020, 11:21am UTC](https://discourse.julialang.org/t/are-type-constraints-in-certain-method-definitions-in-linearalgebra-necessary/42670 "2020-07-07T11:21:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jishnub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jishnub/32/33620_2.png) [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Post date:** [July 7, 2020, 11:21am UTC](https://discourse.julialang.org/t/are-type-constraints-in-certain-method-definitions-in-linearalgebra-necessary/42670/1 "2020-07-07T11:21:43Z")

</div>

Eg [getindex for adjoint and transpose](https://github.com/JuliaLang/julia/blob/63179af92cecbc575617648106e5b2f65f267c92/stdlib/LinearAlgebra/src/adjtrans.jl#L190):

```julia
@propagate_inbounds getindex(A::AdjOrTransAbsMat, i::Int, j::Int) = wrapperop(A)(A.parent[j, i])

```

Why do `i` and `j` need to be constrained to `Int`s? They may in principle be anything that the parent array supports, and the wrapper should simply switch the order. Is this necessary for ambiguity resolution? In that case, custom arrays that accept non-int indices – are they expected to add methods to `getindex` for `Adjoint`, `Transpose` and other such wrappers?

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [July 7, 2020, 12:40pm UTC](https://discourse.julialang.org/t/are-type-constraints-in-certain-method-definitions-in-linearalgebra-necessary/42670/2 "2020-07-07T12:40:18Z")

</div>

If you search Base and the standard libraries, it seems that about half of the `getindex` definitions accept `Integer` and the other half require `Int`. It’s a bit annoying…
