I'm having difficulty finding specific answers to what I know is something trivial. I would like to understand how blocks work in Scala. I come from a java/ruby background and it seems that scala has an entirely different way of using blocks.
The following code is from the Play! Framework website. I would like to understand what Action is semantically. Is it an object or a function that accepts a block, or perhaps neither.
object Application extends Controller {
def index = Action {
Ok(views.html.index("Your new application is ready."))
}
}
If it is a function, perhaps it's syntactic sugar for the following (in which case how does scala pass around blocks behind the scenes):
def index = Action({
Ok(views.html.index("Your new application is ready."))
})
Or is it some scala syntax I'm unaware of.
Any references to Scala source code would help me understand how this is working behind the scenes.