Order between `@assume_effects` and `@constprop`

I want to use both @assume_effects :foldable and @constprop :aggressive on some of my methods. Does the order matter? I.e., is there a difference between these two forms:

@assume_effects :foldable @constprop :aggressive f(a, b) = g(a, b)

and

@constprop :aggressive @assume_effects :foldable f(a, b) = g(a, b)

?

I wouldn’t think so. Both just add some :meta information to the code and it would not make sense to me if the order mattered. They even merge together into a single Expr(:meta,...)

julia> @macroexpand Base.@assume_effects :foldable Base.@constprop :aggressive f(a, b) = g(a, b)
:(f(a, b) = begin
          $(Expr(:meta, :($(Expr(:purity, true, true, false, true, false, false, false))), :aggressive_constprop))
          #= REPL[5]:1 =#
          g(a, b)
      end)

julia> @macroexpand Base.@constprop :aggressive Base.@assume_effects :foldable f(a, b) = g(a, b)
:(f(a, b) = begin
          $(Expr(:meta, :aggressive_constprop, :($(Expr(:purity, true, true, false, true, false, false, false)))))
          #= REPL[6]:1 =#
          g(a, b)
      end)

Disclaimer: I am definitively no authority on compiler things though!

1 Like