Possible Duplicate:
Understanding the tilde in Scala’s parser combinators
I saw the following in this play2 tutorial:
val task = {
get[Long]("id") ~
get[String]("label") map {
case id~label => Task(id, label)
}
}
What does the ~ mean? (Searching for ~ in Google didn’t return anything).
And why it seemed to be at the end of a line first and then it seems to connect two attributes?
Scala syntax allows method names to use special characters such as
+,*and:, and to use them as infix operators, which effectively allows operator overloading as well as the creation of new operators. This can make code more concise, but can also make it difficult to figure out what a particular Scala operator does, because you can’t effectively do a Google search for\:or++or~or::or pretty much any Scala operator method name. To make it even more difficult, an implicit conversion may be applied to one of the operands, so the class providing the operator method may not be the same as the declared class of the operand in the source code.UPDATE: Use Scalex