# Composition and inheritance: the Julian way

**URL:** <https://discourse.julialang.org/t/composition-and-inheritance-the-julian-way/11231>\
**Category:** General Usage\
**Tags:** inheritance, structtypes\
**Created:** [May 29, 2018, 1:06pm UTC](https://discourse.julialang.org/t/composition-and-inheritance-the-julian-way/11231 "2018-05-29T13:06:00Z")\
**Posts on this page:** 1\
**Showing post:** 80

<div class="post-metadata">

**Author:** ![gcalderone](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gcalderone/32/1539_2.png) [@gcalderone](https://discourse.julialang.org/u/gcalderone)\
**Post date:** [January 16, 2019, 2:28pm UTC](https://discourse.julialang.org/t/composition-and-inheritance-the-julian-way/11231/80 "2019-01-16T14:28:18Z")

</div>

> [@Raf](#):
>
> What’s the connection between `@forward` and `@quasiabstract` ? I may misunderstand but it seems like this would also make sense as two packages, one for composition and one for concrete subtyping?

Both `@forward` and `@quasiabstract` allow to implement reusing patterns. But what is the best pattern depends on the problem and the boundary conditions (i.e. if Alice and Bob talks to each other…).

Hence it makes sense to provide them in a single package to facilitate switch back and forth, and to provide a clear comparison of the approaches in the examples.

> [@Raf](#):
>
> I’ve always thought there should be a Forward package that just does `@forward` macros well.

AFAIK, the `@forward` macro in `ReusePatterns.jl` is the only one which automatically forwads all the necessary methods.

> [@Raf](#):
>
> I also use Mixers.jl for field/type/macro inheritance and traits take care of method inheritance for the mixin. What would I gain from switching to quasiabstract inheritance?

I’m not sure you will gain anything operationally or in terms of performance. As I said several similar functionalities are provided by other packages.

The point is: do you simply want your code to work, or do you wish to follow a (hopefully) well thought approach (even if it doesn’t provide any practical advantage) ? In the former case you may choose any package you like. In the latter case I suggest you to give `Reusepatterns.jl` a try, and if you find some flaw in the _reasoning_ please tell me. I’m way more interested in understanding **how** it should be done, rather than in the implementation itself.

---

_[View the full topic](https://discourse.julialang.org/t/composition-and-inheritance-the-julian-way/11231)._
