Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Canonicalize function expression #38

Open
tehrengruber opened this issue May 1, 2017 · 0 comments
Open

Canonicalize function expression #38

tehrengruber opened this issue May 1, 2017 · 0 comments

Comments

@tehrengruber
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant