Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Anonymous function as argument in scala

In Play 2.3, the Action.async method has the signature

final def async(block: ⇒ Future[Result]): Action[AnyContent]

I did not figure out the meaning of => Future[Result], is it an anonymous function? Then shouldn't it be () => Future[Result]?

like image 741
Zelong Avatar asked Apr 17 '26 11:04

Zelong


1 Answers

It is a "By-name parameter":

  • Call by name vs call by value in Scala, clarification needed

  • By-name parameter vs anonymous function

like image 146
Filippo Vitale Avatar answered Apr 19 '26 00:04

Filippo Vitale