This is documented in
https://docs.julialang.org/en/v1/devdocs/functions/#Closures-1
but, most importantly, you are talking about internals of the language, not something you should rely on in normal usage.
If you want the fields, really do use a struct
. Otherwise, future changes to the internal representation could easily break your code — for example, the compiler could change the names of the variables closed over at any point.