`in` vs `=` in loop expressions

Continuing the discussion from Supporting syntax `x not in y` as alias for `!(x in y)`:

While I agree, I will note that the parser disagrees with you, and literally does treat in as syntactic sugar for = in loop expressions:

julia> Meta.@dump (x for x ∈ y)
  head: Symbol generator
  args: Array{Any}((2,))
    1: Symbol x
    2: Expr
      head: Symbol =
      args: Array{Any}((2,))
        1: Symbol x
        2: Symbol y

I can’t speak to the intentions of this design decisions, but I must say that I very much agree with it:

It is important that all three “spellings” normalize to the same AST pre-lowering, because macros need to understand for loops. It would deeply suck if macros needed to test against all valid spellings.


Sure, but they didn’t need to normalize to =. They could have normalized to in instead.


for = long predated for in