I was reading the sbt documentation, and I came across this example in the section on multi project builds:
import sbt._
import Keys._
object HelloBuild extends Build {
lazy val root = Project(id = "hello",
base = file(".")) aggregate(foo, bar)
lazy val foo = Project(id = "hello-foo",
base = file("foo"))
lazy val bar = Project(id = "hello-bar",
base = file("bar"))
}
I am wondering how it is possible to reference the values foo and bar before they have been declared? I figure it has something to do with the lazy keyword, but from my reading, I thought the lazy keyword only delayed initialization? It seems here that the values are somehow in scope even before declaration, never mind initialization...
Hopefully someone is able to explain what is going on here!