# Efficient "parent" reference for structs

**URL:** https://discourse.julialang.org/t/efficient-parent-reference-for-structs/81194
**Category:** General Usage
**Tags:** performance, struct
**Created:** [May 17, 2022, 12:20pm UTC](https://discourse.julialang.org/t/efficient-parent-reference-for-structs/81194 "2022-05-17T12:20:45Z")
**Posts on this page:** 1
**Showing post:** 7

<div class="post-metadata">

### Author: ![tpolakovic](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tpolakovic/32/8612_2.png) [@tpolakovic](https://discourse.julialang.org/u/tpolakovic)
#### Post date: [May 18, 2022, 8:40pm UTC](https://discourse.julialang.org/t/efficient-parent-reference-for-structs/81194/7 "2022-05-18T20:40:47Z")

</div>

> [@sstroemer](#):
>
> It’s hard to justify why I’m looking for that without sharing a large code base, but it boils down to the problem of _many_ functions modifying the given `struct` . So basically I have many complex calculations, that each look like `foo(model, component)` , with `component` being of `TypeX` (with multiple types). Every `TypeX` has its own version of `foo(...)` (dispatched based on the component). Of course I could use a closure, which would be easy for a few functions that I need to wrap, but if each `foo(...)` possibly calls multiple `bar(model, component)` internally, that gets out of hand real quick.

I don’t understand the problem here. You need only one `make_foo` for all methods of `foo` because `foo` dispatches.

---

_[View the full topic](https://discourse.julialang.org/t/efficient-parent-reference-for-structs/81194)._
