I am new to Scala coming from Java world. Scala seems to be more complex than Java. Moreover, I noticed that many Scala constructs use ambiguous methods names. Apart from +,-,*, and / that are pretty obvious what they are, is there any reason to use methods like this:
object ActorRef {
implicit final class ActorRefOps[-T](val ref: ActorRef[T]) extends AnyVal {
/**
* Send a message to the Actor referenced by this ActorRef using *at-most-once*
* messaging semantics.
*/
def !(msg: T): Unit = ref.tell(msg)
}
}
When I see an exclamation mark sending a message is the first thing that comes to mind !
Another example:
List has a method named `:::' for list concatenation
Here's how you use it:
val oneTwo = List(1, 2)
val threeFour = List(3, 4)
val oneTwoThreeFour = oneTwo ::: threeFour
println(oneTwo + " and " + threeFour + " were not mutated.")
println("Thus, " + oneTwoThreeFour + " is a new list.")
Is there any technical or architectural reason for trying to use special characters for method names or it just a kind of "show off"?