Eval scoping in macros, or removing eval completely

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.

3 Likes