Changed Expr args for :(:) in 0.7?

In Julia v0.6:

julia> :(2:34) |> dump
Expr
  head: Symbol :
  args: Array{Any}((2,))
    1: Int64 2
    2: Int64 34
  typ: Any

In Julia v0.7

julia> :(2:34) |> dump
Expr
  head: Symbol call
  args: Array{Any}((3,))
    1: Symbol :
    2: Int64 2
    3: Int64 34
  typ: Any

Is this intended behavior? Why is has it changed? The :(:) symbol now appears in the args list, this is unexpected behavior and made my code misbehave. Are there any more of these type of changes?

Yes, this is an intended breaking change. It makes : much more like the other infix operators. See https://github.com/JuliaLang/julia/pull/25957 for more details (it got committed in https://github.com/JuliaLang/julia/pull/26074, but the former PR has more details and motivation).

2 Likes

Also,

using MacroTools
@capture :(2:34) a_:b_ 
(a, b) # (2, 34)

works for me in both v0.6 and v0.7, if you want to unify code for both versions.

3 Likes