Skip to content

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

@uribalb

Description

@uribalb
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...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions