This type of syntax is method calls in operator notation, but they carry over to more than three tokens. As you mentioned:
xs map f
funds:
xs.map(f)
But you can go further and say:
xs map f map g
What means:
xs.map(f).map(g)
For example, in ScalaTest mappers you can say:
result should not be null
This compiles using the compiler:
result.should(not).be(null)
It:
it should "throw an exception" in { ... }
falls into:
it.should("throw an exception").in { ... }
- ( ) in, . . .
, , :
evaluating { ... } should produce [IllegalArgumentException]
:
evaluating {... }, . , "", . , should . , should , , evaluating. should , produce. produce , , [IllegalArgumentException]. , Scala " " . "Manifest" produce java.lang.Class IllegalArgumentException. , should, , , evaluating, java.lang.Class , . , , try, , . , , should TestFailedException. should .
, , :
(evaluating { ... }).should(produce[IllegalArgumentException] (compilerSuppliedManifest))
, , , . , , - , , - . Scala -Xprint:typer Scala, , . , , , , .