# Simplifying Distributions type hierarchy

**URL:** <https://discourse.julialang.org/t/simplifying-distributions-type-hierarchy/31882>\
**Category:** Statistics\
**Created:** [December 5, 2019, 12:55am UTC](https://discourse.julialang.org/t/simplifying-distributions-type-hierarchy/31882 "2019-12-05T00:55:04Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [December 5, 2019, 9:19am UTC](https://discourse.julialang.org/t/simplifying-distributions-type-hierarchy/31882/7 "2019-12-05T09:19:05Z")

</div>

I think that the current approach comes from the early days of Julia when users were still exploring the language — most importantly, before traits were widely used. I have said this before in a previous discussion we had:

> [@Distributions.jl interop for probprog](https://discourse.julialang.org/t/distributions-jl-interop-for-probprog/26912/13):
>
> The first official release of Distributions.jl was in 2013, 6 years ago, before the actual release of Julia 0.3. IMO a lot of its design reflects that, eg it is full of ostensibly performance-enhancing checks and conversions which may not needed anymore, as the compiler got way smarter, the idiomatic Julia style for writing generic code has matured a lot since these days, using traits instead of elaborate type hierarchies, and duck typing where one can get away with it. This is natural …

I agree with @mohamed82008 that a rewrite would be best to demo a simpler setup. I would recommend much less inheritance and parameterization at the API level, and suggest traits instead (inheritance and type parameters could still be used to _implement_ a lot of functionality where they make sense). This could start as a PR, and depending on the reception it could either be merged or become Distributions2.

---

_[View the full topic](https://discourse.julialang.org/t/simplifying-distributions-type-hierarchy/31882)._
