# Eval from macro

**URL:** <https://discourse.julialang.org/t/eval-from-macro/102718>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [August 11, 2023, 3:14pm UTC](https://discourse.julialang.org/t/eval-from-macro/102718 "2023-08-11T15:14:45Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![dylanxyz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dylanxyz/32/36646_2.png) [@dylanxyz](https://discourse.julialang.org/u/dylanxyz)\
**Post date:** [August 11, 2023, 4:59pm UTC](https://discourse.julialang.org/t/eval-from-macro/102718/2 "2023-08-11T16:59:57Z")

</div>

Macros and metaprogramming in julia can be a powerful tool, but it is a good idea to only use macros where there’s no other option. I’m not sure what you trying to do, besides loading `CSV`. So, can’t you just `using CSV`, instead?

Another thing, using `eval` inside a macro is not a good practice, because the macro run a _parse_ time. Instead of `eval`’ing the expression inside the macro, you should _return_ it. So, to correct your macro, you should rewrite as:

```julia
macro my_eval(pkg)
    :(using $pkg)
end

```

But again, what would be the point of such macro if you can just write `using pkg`?

---

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