In docs.scala-lang.org/overviews/quasiquotes/syntax-summary.html#definitions, I see this "variable" called $stats
all over the place. What does it stand for? Is it supposed to mean "statements"? That would be slightly odd to me since you can have expressions...
Well, technically, on AST level you can have statements - when you declare a variable, value or methods with val
, var
or def
it is not something you can assign to something else. When you e.g. declare a new case class it also cannot be treated as an expression.
So stats
is abstraction that covers all of those cases and that it why it appears in bodies of classes, traits and objects, and it is just reasonable to call them "statements" from lack of a better name.