Reassigning Variables within @capture
Open
- Dominant language
- Julia
- Stars
- 320
- Forks
- 84
- PR merge metrics
- No merged PRs in 30d
Description
`@capture` introduces assignments to variables indicated in its second argument. When one of these assignments is to a variable with the same name as the first argument, things seem to go wrong — the match fails and the value of that variable is set to `nothing`. I think the better behavior in this case would be for the match to succeed, and for `ex` and `b` in the second example to have the values of `a` and `b` in the first.
```
julia> ex = :(1 + 2)
:(1 + 2)
julia> @capture(ex, a_ + b_)
true
julia> @capture(ex, ex_ + b_)
false
julia> ex
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.