-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Definition of function with keyword arguments via macro does not work as expected #8338
Comments
Keyword arguments look like assignments, but they are not -- they are :kw expressions:
I assume that, in the first case, the parser treats the content of esc(...) expression as assignment statement, so that its LHS (left hand side) is a sequence of statements ("x" and "y=3"), where "y=3" is an assignment again. In your second case, the return statement forces the parser to treat this as function definition, and "y=3" is then correctly parsed as keyword argument. If this is true, then using the "function" syntax for your function definition should help as well. |
Consider the following example:
Or:
Whereas if the
return
statment within the function is expicitly written, it works:Julia Version 0.3.0
Commit 7681878 (2014-08-20 20:43 UTC)
The text was updated successfully, but these errors were encountered: