-
-
Couldn't load subscription status.
- Fork 81
Open
Description
Typically, if @capture(expr, match_1) matches you would expect @capture(expr, match_1 | match_2) to always also match. This is however not the case. For example:
julia> @capture(:(begin; x = 2;y=3; end), begin body_ end)
true
julia> body
quote
#= REPL[2]:1 =#
x = 2
#= REPL[2]:1 =#
y = 3
endmatches, but the following
julia> @capture(:(begin; x = 2;y=3; end), begin body_ end | for i_ in iter_ forbody_ end)
falsedoes not. In addition, it the expression in the block only contains one expression, there will be a match:
julia> @capture(:(begin; x = 2; end), begin body_ end | for i_ in iter_ forbody_ end)
true
julia> body
:(x = 2)This feels inconsistent to me.
Metadata
Metadata
Assignees
Labels
No labels