# Macro: escaping, evaluation, scope etc,

**URL:** <https://discourse.julialang.org/t/macro-escaping-evaluation-scope-etc/75875>\
**Category:** General Usage\
**Tags:** macros\
**Created:** [February 5, 2022, 8:57pm UTC](https://discourse.julialang.org/t/macro-escaping-evaluation-scope-etc/75875 "2022-02-05T20:57:06Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [February 5, 2022, 9:16pm UTC](https://discourse.julialang.org/t/macro-escaping-evaluation-scope-etc/75875/2 "2022-02-05T21:16:18Z")

</div>

> [@Eben60](#):
>
> `eval(x)`

It’s almost never necessary or helpful to use `eval` in a macro. A macro takes _code_ (not the values represented by that code) and produces new code, so it shouldn’t need to `eval` anything.

It seems like you don’t need a macro at all–using a function solves the problem perfectly:

```julia
function gk(x)
  keys(x)
end

```

(or, at that point, don’t even define `gk` at all and just call `keys` yourself).

Can you explain more about the problem you actually want to solve?

---

_[View the full topic](https://discourse.julialang.org/t/macro-escaping-evaluation-scope-etc/75875)._
