# Accessing data in a closure?

**URL:** <https://discourse.julialang.org/t/accessing-data-in-a-closure/54930>\
**Category:** New to Julia\
**Tags:** closure\
**Created:** [February 9, 2021, 2:35pm UTC](https://discourse.julialang.org/t/accessing-data-in-a-closure/54930 "2021-02-09T14:35:16Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)\
**Post date:** [February 9, 2021, 7:40pm UTC](https://discourse.julialang.org/t/accessing-data-in-a-closure/54930/11 "2021-02-09T19:40:58Z")

</div>

You are looking at the Developer’s Documentation, not the User’s Manual.

Accessing captured variables as fields in a closure object **is** an implementation detail, we have [word of god](https://tvtropes.org/pmwiki/pmwiki.php/Main/WordOfGod) on this:

> [@Function factories or callable structs?](https://discourse.julialang.org/t/function-factories-or-callable-structs/52987/7):
>
> 100% with one caveat: accessing the fields of a closure is not technically a stable part of the language’s API, so if you need to access the `a` field then you should use the explicit struct approach since that is guaranteed to work no matter what changes are made to the compiler. If you don’t need to access the `a` field then it’s just a matter of preference.

---

_[View the full topic](https://discourse.julialang.org/t/accessing-data-in-a-closure/54930)._
