# Singleton types vs. instances as type parameters

**URL:** <https://discourse.julialang.org/t/singleton-types-vs-instances-as-type-parameters/2802>\
**Category:** General Usage\
**Created:** [March 21, 2017, 6:28pm UTC](https://discourse.julialang.org/t/singleton-types-vs-instances-as-type-parameters/2802 "2017-03-21T18:28:56Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![andyferris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andyferris/32/235_2.png) [@andyferris](https://discourse.julialang.org/u/andyferris)\
**Post date:** [March 22, 2017, 7:20am UTC](https://discourse.julialang.org/t/singleton-types-vs-instances-as-type-parameters/2802/11 "2017-03-22T07:20:21Z")

</div>

This is a very interesting thread. I too have used both, oscillating between the two.

I believe the place where this advice was dispenced was begins in this point of this github thread: [https://github.com/JuliaLang/julia/pull/9452#issuecomment-68528662](https://github.com/JuliaLang/julia/pull/9452#issuecomment-68528662)

I have actually come full circle since then (at least once) - and now I believe instances are more powerful and flexible. for traits and singletons. In fact, that discussion seems to predate `@pure` - it might be worth reviewing `Val(x)::Val{x}` in this light (that’s easy syntax for both the caller and callee).

Thank you @rdeits for showing the `typeassert` trick - that’s _very_ neat, I usually do these type parameter assertions in a cluncky way.

---

_[View the full topic](https://discourse.julialang.org/t/singleton-types-vs-instances-as-type-parameters/2802)._
