You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
functiongen_sym(pattern,body)
quote@metafunctiontestfun($pattern) begin$(body...)
endendend@macromethodtest(pattern,begin*{body} end) begin
pattern_tree =analyze(pattern,current_module()).child
#matchfun = matcher(pattern,@currentmodule)if pattern_tree.head.sym !=:callerror("not a function call")
end
fun =gen_sym(pattern,body)
quote$fun
endendmacroexpand(:(@testf(:E{x,2},:T{y,Int}) beginf(x+y)
end))
@metafunction and @macromethod only work in the global scope, because they need to call eval. I will see if I can do something about this.. (I am about two thirds done with the slurp refactoring I've been meaning to do, than I will take a look at all the other issues)
Meanwhile, see if you can't use ExpressionPatterns.Destructuring to solve your problem. If you don't need dispatch, you can just use @funds.
results in
:($(Expr(:error, MethodError(haskey, (ExpressionPatterns.Dispatch.TopMetaTables.MetaModuleTable(Dict{Symbol,ExpressionPatterns.Dispatch.Structure.MetaMethodTable}(), Set{Symbol}()), :($(Expr(:globalref, Main, :testfun)))), 0x0000000000005886))))
I can't see why?
Why can't i return a metafunction?
thanks
The text was updated successfully, but these errors were encountered: