# Why use subtypes instead of traits and duck typing?

**URL:** <https://discourse.julialang.org/t/why-use-subtypes-instead-of-traits-and-duck-typing/59146>\
**Category:** General Usage\
**Tags:** inheritance, traits\
**Created:** [April 13, 2021, 4:51am UTC](https://discourse.julialang.org/t/why-use-subtypes-instead-of-traits-and-duck-typing/59146 "2021-04-13T04:51:33Z")\
**Posts on this page:** 1\
**Showing post:** 31

<div class="post-metadata">

**Author:** ![Raf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raf/32/3383_2.png) [@Raf](https://discourse.julialang.org/u/Raf)\
**Post date:** [April 15, 2021, 3:54pm UTC](https://discourse.julialang.org/t/why-use-subtypes-instead-of-traits-and-duck-typing/59146/31 "2021-04-15T15:54:39Z")

</div>

Thinking about my last comment… it does seem to mean there essentially no difference between a concrete type inheriting from and abstract type, and traits. Subtyping inheritance for abstract types is just a nice general way of defining a tree structure to specify traits.

Then subtyping inheritance for a concrete type is like an unnamed, default trait, with syntactic sugar.

But you can have multiple subtyping trees of arbitrary specificity for dispatch:

```julia
somfunction(object::AbstractType, trait1::Val{<:AbstractTrait1}, trait2::Val{<:AbstractTrait2}) = ...

```

And the first is not special.

---

_[View the full topic](https://discourse.julialang.org/t/why-use-subtypes-instead-of-traits-and-duck-typing/59146)._
