# 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:** 6

<div class="post-metadata">

**Author:** ![abraemer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abraemer/32/51403_2.png) [@abraemer](https://discourse.julialang.org/u/abraemer)\
**Post date:** [March 25, 2024, 12:18pm UTC](https://discourse.julialang.org/t/i-dont-understand-how-to-do-self-referencial-parametric-typing/112080/6 "2024-03-25T12:18:29Z")

</div>

> [@HenriDeh](#):
>
> You can do self-referencial types if they are non-parametric ([Constructors · The Julia Language](https://docs.julialang.org/en/v1/manual/constructors/#Incomplete-Initialization)) but I can’t figure it out for parametric types.
> 
> But if it’s impossible then I’ll find another way.

This is indeed not possible:

> [@Mutually recursive type](https://discourse.julialang.org/t/mutually-recursive-type/25536):
>
> struct A b::B end struct B a::A end how to do this?

There are workarounds (e.g. abstract types and mutable structs) which you probably won’t like even though they are likely cheap from a runtime perspective.

---

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