Scala tree matching: quasiquotes vs case classes


Hi All,

I am new to Scala and FP so I apologize in advance if there is something that I missed.

I am currently working on a compiler that reads Scala syntax trees and produces an Intermediate Language (IL) that we have defined for further compilation/analysis steps. This looks like this:

    def transform(tree: Tree, ... ): ILTree = tree match { ...

So far, we’ve been using case classes to match the trees. For example:

    case ValDef(mods, name, tpt, rhs) => ...

I have recently descovered a wonderful feature called quasiquotes which allows us to match the trees as well but in a different way. For example:

    case q"$mods val $name: $tpt = $rhs" => ...

In the above example I would need a second quasiquote to match the case of a var but I would need something similar in the case class example too where I could use isVar or isVal methods to make the distinction.

Since these are two solutions to the same problem (both of them with pros and cons presumably) I was wondering if you could help me understand which approach is better and why ?
Which of the two approaches is more idiomatic and more future proof ?

P.S.: Will Dotty support quasiquotes ?

Thank you in advance !