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

removing `eval` when generating match ASTs

Open thautwarm opened this issue 3 years ago • 1 comments

The following uses are trivial to fix. They are only to evaluate the type representation from global scope.

https://github.com/thautwarm/MLStyle.jl/blob/2b7f0a7be19462ea741389266d5c3e04ead21409/src/MatchImpl.jl#L172 https://github.com/thautwarm/MLStyle.jl/blob/2b7f0a7be19462ea741389266d5c3e04ead21409/src/MatchImpl.jl#L215 https://github.com/thautwarm/MLStyle.jl/blob/2b7f0a7be19462ea741389266d5c3e04ead21409/src/MatchImpl.jl#L228 https://github.com/thautwarm/MLStyle.jl/blob/2b7f0a7be19462ea741389266d5c3e04ead21409/src/MatchImpl.jl#L237 https://github.com/thautwarm/MLStyle.jl/blob/2b7f0a7be19462ea741389266d5c3e04ead21409/src/MatchImpl.jl#L241

This one needs to expand macros, so the use here might not get eliminated. The good news is that very few people do AST matching using the pattern @mymacro $(args...), and tasks using MLStyle for codegen in the generated functions will be just fine.

https://github.com/thautwarm/MLStyle.jl/blob/2b7f0a7be19462ea741389266d5c3e04ead21409/src/MatchImpl.jl#L266

thautwarm avatar Jul 19 '22 03:07 thautwarm

static_eval: https://github.com/JuliaLang/julia/blob/master/src/codegen.cpp#L2270

thautwarm avatar Jul 27 '22 10:07 thautwarm