6
votes

I am trying to understand what exactly happens, when I call

val f = scala.concurrent.Future {... // my body function }

The code of object Future defines apply methods as follows:

def apply[T](body: =>T)(implicit execctx: ExecutionContext): Future[T] =
   impl.Future(body)

Unfortunately I do not see where the impl is defined in the code (and what it exactly does). My question is where the impl is defined.

1

1 Answers

5
votes

impl is just a package from which Future object borrows implementation class.

enter image description here

Since Future object lives in the same concurrent package it could address impl package effortlessly (no explicit imports required)