Scala object call with a brackets. What is going on? : In a Scala codebase I see this:


    override def borrow(implicit doLater: DoLater): Borrow = {
      ...

      doLater({
        store.shutdown(10.seconds)
        close()
      })
      ...

The above code gets called like this:

    val d = new DoLater
        try {
          f(d)

and `f` is a function that looks like this:


    implicit doLater =>
          val borrows = borrow

What is going on in above `doLater({...` call? Is it going to call the apply method and pass in this bracketed thing? `doLater` in the `borrow` method is an instance of the `DoLater` class right? What is the bracketed thing? Is it an anonymous class?

the `doLater` is an instance of this class:


    class DoLater {
        var thingsToDo: Seq[() => Unit] = Seq.empty
        override def apply(d: => Unit) = {
          thingsToDo = d _ +: thingsToDo
        }
        ...

I'm jsut trying to figure our, Scala-Wise... what is going on in the `doLater({...` call.


