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
When I write macros acting on function expressions I often write a lot of code such that the macro works for different types of declarations. E.g:
@some_macro a(x)=1
@some_macro function a(x)
1
end
# or
@some_macro function a{T <: Float64}(x::T)
1
end
@some_macro function a(x) where T <: Float64
1
end
Since this leads to a lot of unnecessary macro code it would be nice if there was some sort of canonical form in which an expression could be converted to. MacroTools already has a function longdef that does part of what is needed, but does not rewrite where expressions. Do we want a function canonicaldef or something similar that rewrites functions with where syntax into the regular fn_name{targs...}(args...) syntax? If that is the case is another proposals for the naming beside canonicaldef? I would be happy to contribute that function in a pull request.
The text was updated successfully, but these errors were encountered:
When I write macros acting on function expressions I often write a lot of code such that the macro works for different types of declarations. E.g:
Since this leads to a lot of unnecessary macro code it would be nice if there was some sort of canonical form in which an expression could be converted to. MacroTools already has a function
longdef
that does part of what is needed, but does not rewritewhere
expressions. Do we want a functioncanonicaldef
or something similar that rewrites functions withwhere
syntax into the regularfn_name{targs...}(args...)
syntax? If that is the case is another proposals for the naming besidecanonicaldef
? I would be happy to contribute that function in a pull request.The text was updated successfully, but these errors were encountered: