# Are generic types worth the complexity?

**URL:** <https://discourse.julialang.org/t/are-generic-types-worth-the-complexity/67658>\
**Category:** General Usage\
**Tags:** type, functions\
**Created:** [September 3, 2021, 4:52pm UTC](https://discourse.julialang.org/t/are-generic-types-worth-the-complexity/67658 "2021-09-03T16:52:00Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Vasily\_Pisarev](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vasily_pisarev/32/7929_2.png) [@Vasily\_Pisarev](https://discourse.julialang.org/u/Vasily_Pisarev)\
**Post date:** [September 3, 2021, 5:29pm UTC](https://discourse.julialang.org/t/are-generic-types-worth-the-complexity/67658/3 "2021-09-03T17:29:15Z")

</div>

It’s worth it to at least annotate argument types as `AbstractVector` or alike. Because it won’t be long before someone would like to pass an array view to a function that only accepts `Vector`s.

I would not recommend constraining the element type of collection at all because e.g. units from [Unitful.jl](https://github.com/PainterQubits/Unitful.jl) do not subtype `Number` but may be used as number-like values in many circumstances.

I agree that it’s a bit disturbing, but couldn’t find a better solution 🤷‍♂️

---

_[View the full topic](https://discourse.julialang.org/t/are-generic-types-worth-the-complexity/67658)._
