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

Function definition with 0 keyword arguments fails #14758

Closed
cstjean opened this issue Jan 21, 2016 · 1 comment
Closed

Function definition with 0 keyword arguments fails #14758

cstjean opened this issue Jan 21, 2016 · 1 comment

Comments

@cstjean
Copy link
Contributor

cstjean commented Jan 21, 2016

This code fails on Julia 0.4, with a syntax errror: malformed expression.

kwargs = Any[]
eval(:(function foo(a, b; $(kwargs...)) end))

It works when kwargs contains some keyword arguments. Normally, function definitions with 0 keyword arguments are handled by the parser and converted to a keyword-less function definition, so it's not usually a problem:

:(function foo(a, b;) end)
> :(function foo(a,b)
>    end)

but it's a (minor) issue when writing function definition macros.

@cstjean
Copy link
Contributor Author

cstjean commented Jan 22, 2016

Awesome, thanks!

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