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

@bounce macro chockes on keyword arguments: "syntax: invalid syntax ; [keyword] = [keyword_value]" #124

Open
uribalb opened this issue Sep 22, 2020 · 0 comments

Comments

@uribalb
Copy link

uribalb commented Sep 22, 2020

using Lazy
@bounce pow(x, n ; res=1) = n > 0 ? pow(x, n-1; res=res*x) : res

gives the error:

syntax: invalid syntax ; res = 1

Stacktrace:
 [1] top-level scope at In[2]:2
 [2] include_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1091

because the macro definition doesn't account for this case.
At https://github.com/MikeInnes/Lazy.jl/blob/master/src/tail.jl#L134, the function definition should be;

$f($(args...);$(kwargs...)) = trampoline($f_tramp, $(args...); $(kwargs...))

instead of

$f($(args...)) = trampoline($f_tramp, $(args...))

with args, kwargs defined by pattern-matching rather than directly indexing args arrays. Minor PR incoming...

uribalb added a commit to uribalb/Lazy.jl that referenced this issue Sep 22, 2020
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