One of Scala's nice niche features is that many binary operations (e. g. f(x, y)) can be invoked from the infix position x f y. This applies to normal method calls:
case class InfixMethodCalls(x: Int) { def wild(y: Int): Int = x + y } val infix = InfixMethodCalls(3) infix wild 4
type constructors:
// A simple union type based on http://www.scalactic.org/ trait Or[A, B] case class Good[A, B](value: A) extends Or[A, B] case class Bad[A, B](value: B) extends Or[A, B] def myMethod(x: Int Or String): Int // This is the same as def myMethod(x: Or[Int, String]): Int
and unapply / unapplySeq:
object InfixMagic { def unapply(x: Any) = Option((List(x), x)) } 123 match { case v :: Nil InfixMagic x => println(s"got v: $v and x: $x") } // is the same as 123 match { case InfixMagic(v :: Nil, x) => println(s"got v: $v and x: $x") }
So in the case of XmlGet this syntax here:
case "open" :: Nil XmlGet _ =>
is the same as:
case XmlGet("open" :: Nil, _) =>
And the _ is ignoring the Req parameter, which is the second part of the returned value from TestGet.unapply.
_ :: Nil.