# Using eval inside macro?

**URL:** <https://discourse.julialang.org/t/using-eval-inside-macro/8183>\
**Category:** General Usage\
**Created:** [January 5, 2018, 3:29pm UTC](https://discourse.julialang.org/t/using-eval-inside-macro/8183 "2018-01-05T15:29:19Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [January 5, 2018, 3:39pm UTC](https://discourse.julialang.org/t/using-eval-inside-macro/8183/2 "2018-01-05T15:39:03Z")

</div>

`eval` in macro can easily evaluate in the wrong scope. It is totally OK if the intended sematic is to evaluate the part of the expression only in top-level (global) scope, which includes macros that should only be used in global scope, like `@enum`. You should also make sure the eval is done in the right module (`current_module()` pre-0.7 and ` __module__ ` post-0.7).

---

_[View the full topic](https://discourse.julialang.org/t/using-eval-inside-macro/8183)._
