DataFramesMeta.jl icon indicating copy to clipboard operation
DataFramesMeta.jl copied to clipboard

Fix macro hygiene

Open pdeffebach opened this issue 4 years ago • 3 comments

I need to not esc everything at once. See discussion here.

pdeffebach avatar Nov 22 '21 16:11 pdeffebach

Here is the problem in particular:

julia> using DataFrames

julia> using DataFramesMeta: @transform

julia> df = DataFrame(x = [1, 2]);

julia> @transform df :y = :x .+ :x .^ 2
ERROR: UndefVarError: DataFramesMeta not defined
Stacktrace:
 [1] top-level scope
   @ ~/.julia/packages/DataFramesMeta/yzaoq/src/macros.jl:1190

The offending line is here.

Unfortunately I really don't know what to do in this exact instance, since this call is pretty deeply nested inside a helper function shared by everything. I can't just copy and paste it into each macro call. cc @jkrumbiegel , do you have any ideas on a fix?

pdeffebach avatar Nov 22 '21 16:11 pdeffebach

The error from that line can probably be fixed by :($make_source_concrete($(Expr(:vect, t...)))), but I haven't tried.

mcabbott avatar Nov 22 '21 17:11 mcabbott

Cool that seems to have fixed it. Great, I was worried that I would be really out of luck. I will make a PR for this after I merge #307

pdeffebach avatar Nov 22 '21 18:11 pdeffebach

Fixed in #384

pdeffebach avatar Mar 01 '24 15:03 pdeffebach