Unexpected matches in @capture of function definition
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 320
- Forks
- 84
- PR merge metrics
- No merged PRs in 30d
Description
I ran into some unexpected matching behavior in a function definition (see below). I'm not sure if this should be a match or not. However, if it is a match it seems to by swapping xsym and args (e.g., I would expect xsym to get :x rather than args getting that). I'm guessing this can be worked around by using some of the function definition documentation?
julia> @MacroTools.capture(:(function f(x; n=100) return 1 end), function funsym_(xsym_, args__) body_ end)
true
julia> xsym
:($(Expr(:parameters, :(n=100))))
julia> args
1-element Array{Any,1}:
:x
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the @MacroTools.capture entry point and the linked function-definition documentation, then reproduce the Julia example exactly. Compare the bindings assigned to xsym and args with the documented matching semantics; done means the intended behavior is established and the example is corrected or clearly documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100