Looking at akka's source I faced the following construction:
def apply[T <: Actor: ClassTag](creator: ⇒ T): Props
I was confused by the creator: ⇒ T
parameter declaration. So, trying it myself
class TestFunction {
def test(foo: => Int) = {
println(foo.getClass)
println(foo)
}
}
val testFoo = TestFunction()
testFoo.test(10)
I got the following result:
int
10
And it works completely the same as if it would be declared just as def test(foo: Int)
. What does =>
stand for in the parameter declaration?