I have a class with the following method:
def message[A <: AnyRef](a: A) = a match {
case str: String => messages ++ str
case _: AnyRef => serializer.write(_) //compile error
}
I thought _
may be used in any situation we don't want to use some specific character. But
def message[A <: AnyRef](a: A) = a match {
case str: String => messages ++ str
case a: AnyRef => serializer.write(a)
}
works fine.
What's a problem with _
? What is the limit of its usage as method parameters?