# Eval scoping in macros, or removing eval completely

**URL:** <https://discourse.julialang.org/t/eval-scoping-in-macros-or-removing-eval-completely/54602>\
**Category:** General Usage\
**Tags:** metaprogramming\
**Created:** [February 4, 2021, 9:48am UTC](https://discourse.julialang.org/t/eval-scoping-in-macros-or-removing-eval-completely/54602 "2021-02-04T09:48:53Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![WschW](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wschw/32/6575_2.png) [@WschW](https://discourse.julialang.org/u/WschW)\
**Post date:** [February 4, 2021, 8:57pm UTC](https://discourse.julialang.org/t/eval-scoping-in-macros-or-removing-eval-completely/54602/3 "2021-02-04T20:57:26Z")

</div>

You can use `getfield` on the module to look up a symbol in a module. If the representation of the type is unqualified and non-parametric this is all you need.

An example of a qualified representation is `Base.RefValue`. Since it is qualified you will need to run getfield on the qualifiers recursively until you get to the type itself. In this case you would need to use `getfield` to extract the field by `:Base` in the current module and then check the `:RefValue` within it. This is required as `getfield` only accepts symbols as arguments and the path to the type is an expression.

---

_[View the full topic](https://discourse.julialang.org/t/eval-scoping-in-macros-or-removing-eval-completely/54602)._
