Macro: escaping, evaluation, scope etc,

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:

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?

2 Likes