Use case and examples for type pattern with type variable
问题 I found out reading the spec that scala supports binding type variables when doing a type pattern match: Map(1 -> "one", 2 -> "two") match { case l: Map[k, v] => // binds k to Int and v to String // k and v are types as shown here: val i: Iterator[Tuple2[k, v]] = l.iterator println(i.mkString(", ")) } Are there any fancy things or practical things I can do with this? Or binding type variables is only useful for type documentation purpose? It occurred to me that Scala sometimes needs type