# I don't understand how to do self-referencial parametric typing

**URL:** <https://discourse.julialang.org/t/i-dont-understand-how-to-do-self-referencial-parametric-typing/112080>\
**Category:** General Usage\
**Tags:** question\
**Created:** [March 25, 2024, 11:20am UTC](https://discourse.julialang.org/t/i-dont-understand-how-to-do-self-referencial-parametric-typing/112080 "2024-03-25T11:20:20Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [March 25, 2024, 1:03pm UTC](https://discourse.julialang.org/t/i-dont-understand-how-to-do-self-referencial-parametric-typing/112080/7 "2024-03-25T13:03:19Z")

</div>

> [@HenriDeh](#):
>
> I’m trying to build two tree node types that keep track of a set of instances of each other.

Beware of trying to use parametric types like this for a tree, because then you are encoding the tree structure into the type — every distinct tree structure will have a distinct type, forcing the compiler to recompile/specialize code for every tree.

See also

- [Tree structure with parametric type - #2 by rdeits](https://discourse.julialang.org/t/tree-structure-with-parametric-type/9300/2)
- [Why are self-referential struct parameters impossible? - #2 by stevengj](https://discourse.julialang.org/t/why-are-self-referential-struct-parameters-impossible/110982/2)

---

_[View the full topic](https://discourse.julialang.org/t/i-dont-understand-how-to-do-self-referencial-parametric-typing/112080)._
