thautwarm / MLStyle.jl

Julia functional programming infrastructures and metaprogramming facilities
https://thautwarm.github.io/MLStyle.jl/latest/
MIT License
404 stars 39 forks source link

Directly matching macrocall expressions #59

Closed thautwarm closed 2 years ago

thautwarm commented 5 years ago

Now, as the line number node contained in macrocall expressions

julia> dump(:(@f 1))
Expr
  head: Symbol macrocall
  args: Array{Any}((3,))
    1: Symbol @f
    2: LineNumberNode
      line: Int64 1
      file: Symbol REPL[1]
    3: Int64 1

We cannot use

@match :(@f 1) begin
   :(@f 1) => :okay
end

However, we can instead use

@match :(@f 1) begin
   :(@f $(::LineNumberNode) 1) => :okay
end

This should be a tip put in docs.

thautwarm commented 2 years ago

done in v0.4.