# Parsimonious way to unpack big structs

**URL:** <https://discourse.julialang.org/t/parsimonious-way-to-unpack-big-structs/66522>\
**Category:** General Usage\
**Tags:** struct\
**Created:** [August 17, 2021, 12:02am UTC](https://discourse.julialang.org/t/parsimonious-way-to-unpack-big-structs/66522 "2021-08-17T00:02:34Z")\
**Posts on this page:** 1\
**Showing post:** 17

<div class="post-metadata">

**Author:** ![amrods](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amrods/32/2543_2.png) [@amrods](https://discourse.julialang.org/u/amrods)\
**Post date:** [August 18, 2021, 7:03am UTC](https://discourse.julialang.org/t/parsimonious-way-to-unpack-big-structs/66522/17 "2021-08-18T07:03:00Z")

</div>

> [@jlperla](#):
>
> But the problem with your code is one of defensive programming: `α, β, γ = p.α, p.β, p.γ` is extremely error prone. If you accidentally get them out of order, maybe after adding a new parameter or removing one, then you will get all sorts of silent bugs.

That’s precisely what [drove me to ComponentArrays](https://discourse.julialang.org/t/namedarrays-vs-namedtuples-vs-dict-in-objective-function-to-optimization/42659). It is also very tedious to change the code to try different model pieces that take subsets of a large vector of parameters.

> [@apo383](#):
>
> If other people will look at the code, I’d prefer to at least give a hint with
> 
> ```julia
> (; a, b) = p # unpacking fields
> 
> ```

That is what I do, just with `@unpack`.

---

_[View the full topic](https://discourse.julialang.org/t/parsimonious-way-to-unpack-big-structs/66522)._
