FastClosures.jl icon indicating copy to clipboard operation
FastClosures.jl copied to clipboard

@closure with unnamed anonymous function declared with "function" keyword?

Open colinxs opened this issue 5 years ago • 1 comments

Is there a reason why this is disallowed?

@closure function (x,y,z)
    x+a
end

It stems from this assert here: https://github.com/c42f/FastClosures.jl/blob/f9314209eacf90fc49ca4a1e320f71ae12c8f73b/src/FastClosures.jl#L40

Happy to contribute a PR to handle this case, but just wanted to check if there's a reason for that assert. Seems related to #1.

colinxs avatar Feb 19 '20 22:02 colinxs

Happy to contribute a PR to handle this case

Please do! The reason this exists is because FastClosures doesn't understand the full set of anonymous function syntaxes: we need to reproduce parts of lowering within the macro to get access to allow each the possible syntactic forms.

The solution is to add code which recognizes more of the forms.

c42f avatar Feb 20 '20 00:02 c42f